@uniformdev/canvas-vue 19.38.2 → 19.38.3-alpha.78
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 +24 -8
- package/dist/index.d.ts +24 -8
- package/dist/index.esm.js +70 -51
- package/dist/index.js +102 -82
- package/dist/index.mjs +70 -51
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -31,13 +31,14 @@ __export(src_exports, {
|
|
|
31
31
|
TextRichTextNode: () => TextRichTextNode,
|
|
32
32
|
UniformComponent: () => UniformComponent,
|
|
33
33
|
UniformComposition: () => UniformComposition,
|
|
34
|
+
UniformPlayground: () => UniformPlayground,
|
|
34
35
|
UniformRichText: () => UniformRichText,
|
|
35
36
|
UniformRichTextNode: () => UniformRichTextNode,
|
|
36
37
|
UniformSlot: () => UniformSlot,
|
|
37
38
|
UniformText: () => UniformText,
|
|
38
39
|
convertComponentToProps: () => convertComponentToProps,
|
|
39
40
|
createUniformApiEnhancer: () => import_canvas3.createUniformApiEnhancer,
|
|
40
|
-
getParameterAttributes: () =>
|
|
41
|
+
getParameterAttributes: () => import_canvas9.getParameterAttributes,
|
|
41
42
|
globalCompositionEnhancerInjectionKey: () => globalCompositionEnhancerInjectionKey,
|
|
42
43
|
useCompositionEventEffect: () => useCompositionEventEffect,
|
|
43
44
|
useUniformContextualEditing: () => useUniformContextualEditing,
|
|
@@ -315,25 +316,29 @@ var ContextualEditingComponentWrapper = (0, import_vue_demi4.defineComponent)({
|
|
|
315
316
|
var _a;
|
|
316
317
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
317
318
|
const isPlaceholder = ((_a = props.component) == null ? void 0 : _a._id) === import_canvas4.PLACEHOLDER_ID;
|
|
319
|
+
const component = props.component;
|
|
318
320
|
return () => {
|
|
319
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l
|
|
321
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
320
322
|
return !(isContextualEditing == null ? void 0 : isContextualEditing.value) ? (_b = (_a2 = context.slots).default) == null ? void 0 : _b.call(_a2) : isPlaceholder && ((_d = (_c = context.slots).emptyPlaceholder) == null ? void 0 : _d.call(_c).length) === 0 ? [] : [
|
|
321
323
|
(0, import_vue_demi4.h)("script", {
|
|
322
324
|
"data-role": import_canvas4.IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
|
|
323
325
|
"data-parent-id": (_e = props.parentComponent) == null ? void 0 : _e._id,
|
|
324
326
|
"data-parent-type": (_f = props.parentComponent) == null ? void 0 : _f.type,
|
|
325
|
-
"data-component-id":
|
|
327
|
+
"data-component-id": component == null ? void 0 : component._id,
|
|
326
328
|
"data-slot-name": props.slotName,
|
|
327
329
|
"data-component-index": props.indexInSlot,
|
|
328
330
|
"data-total-components": props.slotChildrenCount,
|
|
329
|
-
"data-component-name":
|
|
331
|
+
"data-component-name": component == null ? void 0 : component.type,
|
|
330
332
|
"data-is-placeholder": isPlaceholder ? "true" : void 0,
|
|
331
|
-
"data-is-localized": ((
|
|
333
|
+
"data-is-localized": ((_g = component == null ? void 0 : component.parameters) == null ? void 0 : _g[import_canvas4.CANVAS_LOCALE_TAG_PARAM]) ? "true" : void 0,
|
|
332
334
|
// TODO: use a proper way to get the component's title, don't assume that it's always "title"
|
|
333
335
|
// https://linear.app/uniform/issue/UNI-937/show-the-right-component-title-in-the-highlighter
|
|
334
|
-
"data-component-title": (
|
|
336
|
+
"data-component-title": (_i = (_h = component == null ? void 0 : component.parameters) == null ? void 0 : _h.title) == null ? void 0 : _i.value,
|
|
337
|
+
// In preview mode if we are viewing a historic entry we do not want to allow
|
|
338
|
+
// the user to add a component to the composition or move the component around the page
|
|
339
|
+
"data-is-readonly": ((_j = component == null ? void 0 : component._contextualEditing) == null ? void 0 : _j.isEditable) ? void 0 : "true"
|
|
335
340
|
}),
|
|
336
|
-
isPlaceholder && context.slots.emptyPlaceholder !== void 0 ? context.slots.emptyPlaceholder() : (
|
|
341
|
+
isPlaceholder && context.slots.emptyPlaceholder !== void 0 ? context.slots.emptyPlaceholder() : (_l = (_k = context.slots).default) == null ? void 0 : _l.call(_k),
|
|
337
342
|
(0, import_vue_demi4.h)("script", { "data-role": import_canvas4.IN_CONTEXT_EDITOR_COMPONENT_END_ROLE })
|
|
338
343
|
];
|
|
339
344
|
};
|
|
@@ -400,20 +405,37 @@ var UniformComposition = (0, import_vue_demi5.defineComponent)({
|
|
|
400
405
|
);
|
|
401
406
|
}
|
|
402
407
|
});
|
|
408
|
+
var UniformComposition_default = UniformComposition;
|
|
403
409
|
|
|
404
|
-
// src/components/
|
|
410
|
+
// src/components/UniformPlayground.ts
|
|
411
|
+
var import_canvas5 = require("@uniformdev/canvas");
|
|
405
412
|
var import_vue_demi6 = require("vue-demi");
|
|
413
|
+
var UniformPlayground = (0, import_vue_demi6.defineComponent)({
|
|
414
|
+
name: "UniformPlayground",
|
|
415
|
+
inheritAttrs: false,
|
|
416
|
+
props: {
|
|
417
|
+
resolveRenderer: {
|
|
418
|
+
type: Object
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
setup(props) {
|
|
422
|
+
return () => (0, import_vue_demi6.h)(UniformComposition_default, { data: import_canvas5.EMPTY_COMPOSITION, resolveRenderer: props.resolveRenderer });
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
// src/components/UniformRichText/nodes/HeadingRichTextNode.ts
|
|
427
|
+
var import_vue_demi7 = require("vue-demi");
|
|
406
428
|
var HeadingRichTextNode = (props, context) => {
|
|
407
429
|
const { tag } = props.node;
|
|
408
|
-
return (0,
|
|
430
|
+
return (0, import_vue_demi7.h)(tag != null ? tag : "h1", {}, context.slots);
|
|
409
431
|
};
|
|
410
432
|
|
|
411
433
|
// src/components/UniformRichText/nodes/LinkRichTextNode.ts
|
|
412
434
|
var import_richtext = require("@uniformdev/richtext");
|
|
413
|
-
var
|
|
435
|
+
var import_vue_demi8 = require("vue-demi");
|
|
414
436
|
var LinkRichTextNode = (props, context) => {
|
|
415
437
|
const { link } = props.node;
|
|
416
|
-
return (0,
|
|
438
|
+
return (0, import_vue_demi8.h)(
|
|
417
439
|
"a",
|
|
418
440
|
{
|
|
419
441
|
href: (0, import_richtext.linkParamValueToHref)(link)
|
|
@@ -423,10 +445,10 @@ var LinkRichTextNode = (props, context) => {
|
|
|
423
445
|
};
|
|
424
446
|
|
|
425
447
|
// src/components/UniformRichText/nodes/ListItemRichTextNode.ts
|
|
426
|
-
var
|
|
448
|
+
var import_vue_demi9 = require("vue-demi");
|
|
427
449
|
var ListItemRichTextNode = (props, context) => {
|
|
428
450
|
const { value } = props.node;
|
|
429
|
-
return (0,
|
|
451
|
+
return (0, import_vue_demi9.h)(
|
|
430
452
|
"li",
|
|
431
453
|
{
|
|
432
454
|
value: Number.isFinite(value) && value > 0 ? value : void 0
|
|
@@ -436,18 +458,18 @@ var ListItemRichTextNode = (props, context) => {
|
|
|
436
458
|
};
|
|
437
459
|
|
|
438
460
|
// src/components/UniformRichText/nodes/ListRichTextNode.ts
|
|
439
|
-
var
|
|
461
|
+
var import_vue_demi10 = require("vue-demi");
|
|
440
462
|
var ListRichTextNode = (props, context) => {
|
|
441
463
|
const { tag } = props.node;
|
|
442
|
-
return (0,
|
|
464
|
+
return (0, import_vue_demi10.h)(tag != null ? tag : "h1", {}, context.slots);
|
|
443
465
|
};
|
|
444
466
|
|
|
445
467
|
// src/components/UniformRichText/nodes/ParagraphRichTextNode.ts
|
|
446
468
|
var import_richtext2 = require("@uniformdev/richtext");
|
|
447
|
-
var
|
|
469
|
+
var import_vue_demi11 = require("vue-demi");
|
|
448
470
|
var ParagraphRichTextNode = (props, context) => {
|
|
449
471
|
const { format, direction } = props.node;
|
|
450
|
-
return (0,
|
|
472
|
+
return (0, import_vue_demi11.h)(
|
|
451
473
|
"p",
|
|
452
474
|
{
|
|
453
475
|
dir: (0, import_richtext2.isPureDirection)(direction) ? direction : void 0,
|
|
@@ -458,61 +480,61 @@ var ParagraphRichTextNode = (props, context) => {
|
|
|
458
480
|
};
|
|
459
481
|
|
|
460
482
|
// src/components/UniformRichText/nodes/QuoteRichTextNode.ts
|
|
461
|
-
var
|
|
483
|
+
var import_vue_demi12 = require("vue-demi");
|
|
462
484
|
var QuoteRichTextNode = (_, context) => {
|
|
463
|
-
return (0,
|
|
485
|
+
return (0, import_vue_demi12.h)("blockquote", {}, context.slots);
|
|
464
486
|
};
|
|
465
487
|
|
|
466
488
|
// src/components/UniformRichText/nodes/RootRichTextNode.ts
|
|
467
|
-
var
|
|
489
|
+
var import_vue_demi13 = require("vue-demi");
|
|
468
490
|
var RootRichTextNode = (props, c) => {
|
|
469
|
-
return (0,
|
|
491
|
+
return (0, import_vue_demi13.h)(() => c.slots.default ? c.slots.default() : null);
|
|
470
492
|
};
|
|
471
493
|
|
|
472
494
|
// src/components/UniformRichText/nodes/TextRichTextNode.ts
|
|
473
495
|
var import_richtext3 = require("@uniformdev/richtext");
|
|
474
|
-
var
|
|
496
|
+
var import_vue_demi14 = require("vue-demi");
|
|
475
497
|
var TextRichTextNode = (props) => {
|
|
476
498
|
const { format, text } = props.node;
|
|
477
499
|
const tags = (0, import_richtext3.getRichTextTagsFromTextFormat)(format);
|
|
478
500
|
return tags.length > 0 ? tags.reduceRight(
|
|
479
501
|
(children, tag) => {
|
|
480
|
-
return (0,
|
|
502
|
+
return (0, import_vue_demi14.h)(tag, null, children);
|
|
481
503
|
},
|
|
482
504
|
{
|
|
483
505
|
default: () => text
|
|
484
506
|
}
|
|
485
|
-
) : (0,
|
|
507
|
+
) : (0, import_vue_demi14.h)(() => text);
|
|
486
508
|
};
|
|
487
509
|
|
|
488
510
|
// src/components/UniformRichText/UniformRichText.ts
|
|
489
511
|
var import_richtext5 = require("@uniformdev/richtext");
|
|
490
|
-
var
|
|
512
|
+
var import_vue_demi19 = require("vue-demi");
|
|
491
513
|
|
|
492
514
|
// src/components/UniformRichText/UniformRichTextNode.ts
|
|
493
515
|
var import_richtext4 = require("@uniformdev/richtext");
|
|
494
|
-
var
|
|
516
|
+
var import_vue_demi18 = require("vue-demi");
|
|
495
517
|
|
|
496
518
|
// src/components/UniformRichText/nodes/CodeRichTextNode.ts
|
|
497
|
-
var
|
|
519
|
+
var import_vue_demi15 = require("vue-demi");
|
|
498
520
|
var CodeRichTextNode = (_, context) => {
|
|
499
|
-
return (0,
|
|
521
|
+
return (0, import_vue_demi15.h)("pre", {}, (0, import_vue_demi15.h)("code", {}, context.slots));
|
|
500
522
|
};
|
|
501
523
|
|
|
502
524
|
// src/components/UniformRichText/nodes/LinebreakRichTextNode.ts
|
|
503
|
-
var
|
|
525
|
+
var import_vue_demi16 = require("vue-demi");
|
|
504
526
|
var LinebreakRichTextNode = () => {
|
|
505
|
-
return (0,
|
|
527
|
+
return (0, import_vue_demi16.h)("br", {});
|
|
506
528
|
};
|
|
507
529
|
|
|
508
530
|
// src/components/UniformRichText/nodes/TabRichTextNode.ts
|
|
509
|
-
var
|
|
531
|
+
var import_vue_demi17 = require("vue-demi");
|
|
510
532
|
var TabRichTextNode = () => {
|
|
511
|
-
return (0,
|
|
533
|
+
return (0, import_vue_demi17.h)("", {}, " ");
|
|
512
534
|
};
|
|
513
535
|
|
|
514
536
|
// src/components/UniformRichText/UniformRichTextNode.ts
|
|
515
|
-
var UniformRichTextNode = (0,
|
|
537
|
+
var UniformRichTextNode = (0, import_vue_demi18.defineComponent)({
|
|
516
538
|
name: "UniformRichTextNode",
|
|
517
539
|
props: {
|
|
518
540
|
node: {
|
|
@@ -537,13 +559,13 @@ var UniformRichTextNode = (0, import_vue_demi17.defineComponent)({
|
|
|
537
559
|
return () => null;
|
|
538
560
|
}
|
|
539
561
|
const children = node.children ? node.children.map(
|
|
540
|
-
(childNode) => (0,
|
|
562
|
+
(childNode) => (0, import_vue_demi18.h)(
|
|
541
563
|
UniformRichTextNode,
|
|
542
564
|
{ node: childNode, resolveRichTextRenderer: props.resolveRichTextRenderer },
|
|
543
565
|
context.slots
|
|
544
566
|
)
|
|
545
567
|
) : [];
|
|
546
|
-
return () => (0,
|
|
568
|
+
return () => (0, import_vue_demi18.h)(NodeRenderer, { node, children: (0, import_vue_demi18.h)(() => children) }, () => children);
|
|
547
569
|
}
|
|
548
570
|
});
|
|
549
571
|
var rendererMap = /* @__PURE__ */ new Map([
|
|
@@ -564,7 +586,7 @@ var resolveRichTextDefaultRenderer = (node) => {
|
|
|
564
586
|
};
|
|
565
587
|
|
|
566
588
|
// src/components/UniformRichText/UniformRichText.ts
|
|
567
|
-
var UniformRichText = (0,
|
|
589
|
+
var UniformRichText = (0, import_vue_demi19.defineComponent)({
|
|
568
590
|
name: "UniformRichText",
|
|
569
591
|
props: {
|
|
570
592
|
parameterId: {
|
|
@@ -579,14 +601,14 @@ var UniformRichText = (0, import_vue_demi18.defineComponent)({
|
|
|
579
601
|
setup(props, context) {
|
|
580
602
|
var _a;
|
|
581
603
|
const { data: componentData } = useUniformCurrentComponent();
|
|
582
|
-
const value = (0,
|
|
604
|
+
const value = (0, import_vue_demi19.computed)(() => {
|
|
583
605
|
var _a2;
|
|
584
606
|
const parameter = (_a2 = componentData == null ? void 0 : componentData.parameters) == null ? void 0 : _a2[props.parameterId];
|
|
585
607
|
return parameter == null ? void 0 : parameter.value;
|
|
586
608
|
});
|
|
587
609
|
const root = (_a = value.value) == null ? void 0 : _a.root;
|
|
588
610
|
if ((0, import_richtext5.isRichTextNode)(root)) {
|
|
589
|
-
return () => (0,
|
|
611
|
+
return () => (0, import_vue_demi19.h)(
|
|
590
612
|
UniformRichTextNode,
|
|
591
613
|
{
|
|
592
614
|
node: root,
|
|
@@ -601,9 +623,9 @@ var UniformRichText = (0, import_vue_demi18.defineComponent)({
|
|
|
601
623
|
});
|
|
602
624
|
|
|
603
625
|
// src/components/UniformSlot.ts
|
|
604
|
-
var
|
|
626
|
+
var import_canvas6 = require("@uniformdev/canvas");
|
|
605
627
|
var import_context_vue2 = require("@uniformdev/context-vue");
|
|
606
|
-
var
|
|
628
|
+
var import_vue_demi20 = require("vue-demi");
|
|
607
629
|
|
|
608
630
|
// src/helpers/convertComponentToProps.ts
|
|
609
631
|
function convertComponentToProps(component) {
|
|
@@ -628,7 +650,7 @@ function normalizePropName(name) {
|
|
|
628
650
|
}
|
|
629
651
|
|
|
630
652
|
// src/components/UniformSlot.ts
|
|
631
|
-
var UniformSlot = (0,
|
|
653
|
+
var UniformSlot = (0, import_vue_demi20.defineComponent)({
|
|
632
654
|
name: "UniformSlot",
|
|
633
655
|
inheritAttrs: false,
|
|
634
656
|
props: {
|
|
@@ -647,7 +669,7 @@ var UniformSlot = (0, import_vue_demi19.defineComponent)({
|
|
|
647
669
|
if (!parentData || !resolveRenderer) {
|
|
648
670
|
throw new Error("<UniformSlot /> can only be used inside a <UniformComposition />");
|
|
649
671
|
}
|
|
650
|
-
const slotItems = (0,
|
|
672
|
+
const slotItems = (0, import_vue_demi20.computed)(() => {
|
|
651
673
|
var _a2, _b, _c;
|
|
652
674
|
if (props.name) {
|
|
653
675
|
return (_b = (_a2 = parentData.slots) == null ? void 0 : _a2[props.name]) != null ? _b : [];
|
|
@@ -672,9 +694,9 @@ var UniformSlot = (0, import_vue_demi19.defineComponent)({
|
|
|
672
694
|
function renderPersonalizeComponent(component, resolveRenderer) {
|
|
673
695
|
var _a, _b, _c, _d, _e, _f;
|
|
674
696
|
const parameters = component == null ? void 0 : component.parameters;
|
|
675
|
-
const processedVariants = (0,
|
|
697
|
+
const processedVariants = (0, import_canvas6.mapSlotToPersonalizedVariations)((_a = component.slots) == null ? void 0 : _a.pz);
|
|
676
698
|
const name = (_d = (_c = (_b = component.parameters) == null ? void 0 : _b.trackingEventName) == null ? void 0 : _c.value) != null ? _d : "Untitled Personalization";
|
|
677
|
-
return (0,
|
|
699
|
+
return (0, import_vue_demi20.h)(import_context_vue2.Personalize, {
|
|
678
700
|
name,
|
|
679
701
|
// TODO: Fix the `as unknown`
|
|
680
702
|
component: (variant) => resolveRenderer(variant),
|
|
@@ -686,8 +708,8 @@ function renderTestComponent(component, resolveRenderer) {
|
|
|
686
708
|
var _a, _b, _c, _d, _e;
|
|
687
709
|
const variants = (_b = (_a = component == null ? void 0 : component.slots) == null ? void 0 : _a.test) != null ? _b : [];
|
|
688
710
|
const testName = (_e = (_d = (_c = component == null ? void 0 : component.parameters) == null ? void 0 : _c.test) == null ? void 0 : _d.value) != null ? _e : "Untitled Test";
|
|
689
|
-
const finalVariants = (0,
|
|
690
|
-
return (0,
|
|
711
|
+
const finalVariants = (0, import_canvas6.mapSlotToTestVariations)(variants);
|
|
712
|
+
return (0, import_vue_demi20.h)(import_context_vue2.Test, {
|
|
691
713
|
variations: finalVariants,
|
|
692
714
|
name: testName,
|
|
693
715
|
component: (variant) => resolveRenderer(variant)
|
|
@@ -702,7 +724,7 @@ function renderComponent({
|
|
|
702
724
|
slotChildrenCount,
|
|
703
725
|
emptyPlaceholder
|
|
704
726
|
}) {
|
|
705
|
-
if (component.type ===
|
|
727
|
+
if (component.type === import_canvas6.CANVAS_TEST_TYPE) {
|
|
706
728
|
return renderTestComponent(
|
|
707
729
|
component,
|
|
708
730
|
(variantComponent) => {
|
|
@@ -711,16 +733,16 @@ function renderComponent({
|
|
|
711
733
|
component: variantComponent,
|
|
712
734
|
resolveRenderer,
|
|
713
735
|
parentComponent: component,
|
|
714
|
-
slotName:
|
|
715
|
-
slotChildrenCount: (_a = component == null ? void 0 : component.slots) == null ? void 0 : _a[
|
|
716
|
-
indexInSlot: (_b = component == null ? void 0 : component.slots) == null ? void 0 : _b[
|
|
736
|
+
slotName: import_canvas6.CANVAS_TEST_SLOT,
|
|
737
|
+
slotChildrenCount: (_a = component == null ? void 0 : component.slots) == null ? void 0 : _a[import_canvas6.CANVAS_TEST_SLOT].length,
|
|
738
|
+
indexInSlot: (_b = component == null ? void 0 : component.slots) == null ? void 0 : _b[import_canvas6.CANVAS_TEST_SLOT].findIndex(
|
|
717
739
|
({ _id }) => variantComponent._id === _id
|
|
718
740
|
)
|
|
719
741
|
});
|
|
720
742
|
}
|
|
721
743
|
);
|
|
722
744
|
}
|
|
723
|
-
if (component.type ===
|
|
745
|
+
if (component.type === import_canvas6.CANVAS_PERSONALIZE_TYPE) {
|
|
724
746
|
return renderPersonalizeComponent(
|
|
725
747
|
component,
|
|
726
748
|
(variantComponent) => {
|
|
@@ -729,9 +751,9 @@ function renderComponent({
|
|
|
729
751
|
component: variantComponent,
|
|
730
752
|
resolveRenderer,
|
|
731
753
|
parentComponent: component,
|
|
732
|
-
slotName:
|
|
733
|
-
slotChildrenCount: (_a = component == null ? void 0 : component.slots) == null ? void 0 : _a[
|
|
734
|
-
indexInSlot: (_b = component == null ? void 0 : component.slots) == null ? void 0 : _b[
|
|
754
|
+
slotName: import_canvas6.CANVAS_PERSONALIZE_SLOT,
|
|
755
|
+
slotChildrenCount: (_a = component == null ? void 0 : component.slots) == null ? void 0 : _a[import_canvas6.CANVAS_PERSONALIZE_SLOT].length,
|
|
756
|
+
indexInSlot: (_b = component == null ? void 0 : component.slots) == null ? void 0 : _b[import_canvas6.CANVAS_PERSONALIZE_SLOT].findIndex(
|
|
735
757
|
({ _id }) => variantComponent._id === _id
|
|
736
758
|
)
|
|
737
759
|
});
|
|
@@ -741,13 +763,13 @@ function renderComponent({
|
|
|
741
763
|
const resolvedComponent = resolveRenderer == null ? void 0 : resolveRenderer(component);
|
|
742
764
|
if (resolvedComponent) {
|
|
743
765
|
const props = convertComponentToProps(component);
|
|
744
|
-
return (0,
|
|
766
|
+
return (0, import_vue_demi20.h)(
|
|
745
767
|
UniformComponent,
|
|
746
768
|
{ data: component, resolveRenderer },
|
|
747
|
-
() => (0,
|
|
769
|
+
() => (0, import_vue_demi20.h)(
|
|
748
770
|
ContextualEditingComponentWrapper,
|
|
749
771
|
{ component, parentComponent, slotName, indexInSlot, slotChildrenCount },
|
|
750
|
-
{ default: () => (0,
|
|
772
|
+
{ default: () => (0, import_vue_demi20.h)(resolvedComponent, props), emptyPlaceholder }
|
|
751
773
|
)
|
|
752
774
|
);
|
|
753
775
|
}
|
|
@@ -755,14 +777,14 @@ function renderComponent({
|
|
|
755
777
|
`[canvas] found component of type '${component.type}' which the 'resolveRenderer' prop returned no component for. Nothing will be rendered. The resolveRenderer function may need to be extended to handle the new type.`,
|
|
756
778
|
component
|
|
757
779
|
);
|
|
758
|
-
return (0,
|
|
780
|
+
return (0, import_vue_demi20.h)("");
|
|
759
781
|
}
|
|
760
782
|
|
|
761
783
|
// src/components/UniformText.ts
|
|
762
|
-
var
|
|
763
|
-
var
|
|
784
|
+
var import_canvas7 = require("@uniformdev/canvas");
|
|
785
|
+
var import_vue_demi21 = require("vue-demi");
|
|
764
786
|
var DEFAULT_ELEMENT_TYPE = "span";
|
|
765
|
-
var UniformText = (0,
|
|
787
|
+
var UniformText = (0, import_vue_demi21.defineComponent)({
|
|
766
788
|
name: "UniformText",
|
|
767
789
|
inheritAttrs: true,
|
|
768
790
|
props: {
|
|
@@ -786,22 +808,22 @@ var UniformText = (0, import_vue_demi20.defineComponent)({
|
|
|
786
808
|
var _a;
|
|
787
809
|
const { data: componentData, contextualEditingDefaultPlaceholder } = useUniformCurrentComponent();
|
|
788
810
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
789
|
-
const isFocused = (0,
|
|
790
|
-
const parameter = (0,
|
|
811
|
+
const isFocused = (0, import_vue_demi21.ref)(false);
|
|
812
|
+
const parameter = (0, import_vue_demi21.computed)(
|
|
791
813
|
() => {
|
|
792
814
|
var _a2;
|
|
793
815
|
return (_a2 = componentData == null ? void 0 : componentData.parameters) == null ? void 0 : _a2[props.parameterId];
|
|
794
816
|
}
|
|
795
817
|
);
|
|
796
|
-
const value = (0,
|
|
818
|
+
const value = (0, import_vue_demi21.computed)(() => {
|
|
797
819
|
var _a2;
|
|
798
820
|
return (_a2 = parameter.value) == null ? void 0 : _a2.value;
|
|
799
821
|
});
|
|
800
|
-
const isEditable = (0,
|
|
822
|
+
const isEditable = (0, import_vue_demi21.computed)(() => {
|
|
801
823
|
var _a2, _b, _c;
|
|
802
824
|
return (_c = (_b = (_a2 = parameter.value) == null ? void 0 : _a2._contextualEditing) == null ? void 0 : _b.isEditable) != null ? _c : false;
|
|
803
825
|
});
|
|
804
|
-
const shouldSkipCustomRendering = (0,
|
|
826
|
+
const shouldSkipCustomRendering = (0, import_vue_demi21.computed)(() => isFocused.value && isEditable.value);
|
|
805
827
|
const handleOnFocus = () => {
|
|
806
828
|
isFocused.value = true;
|
|
807
829
|
};
|
|
@@ -809,15 +831,12 @@ var UniformText = (0, import_vue_demi20.defineComponent)({
|
|
|
809
831
|
isFocused.value = false;
|
|
810
832
|
};
|
|
811
833
|
if (!parameter) {
|
|
812
|
-
console.warn(
|
|
813
|
-
`UniformText: The parameterId "${props.parameterId}" was not found in the component of type "${componentData == null ? void 0 : componentData.type}"`
|
|
814
|
-
);
|
|
815
834
|
return null;
|
|
816
835
|
}
|
|
817
836
|
if (!isContextualEditing) {
|
|
818
837
|
return () => {
|
|
819
838
|
var _a2, _b, _c, _d;
|
|
820
|
-
return (0,
|
|
839
|
+
return (0, import_vue_demi21.h)(
|
|
821
840
|
(_a2 = props.as) != null ? _a2 : DEFAULT_ELEMENT_TYPE,
|
|
822
841
|
{ style: props.isMultiline ? { whiteSpace: "pre-wrap" } : {} },
|
|
823
842
|
(_d = (_c = (_b = context.slots).default) == null ? void 0 : _c.call(_b, value.value)) != null ? _d : value.value
|
|
@@ -828,17 +847,17 @@ var UniformText = (0, import_vue_demi20.defineComponent)({
|
|
|
828
847
|
const computedPlaceholder = typeof placeholderProp === "function" ? placeholderProp({ id: props.parameterId }) : placeholderProp;
|
|
829
848
|
return () => {
|
|
830
849
|
var _a2, _b, _c, _d, _e;
|
|
831
|
-
return (0,
|
|
850
|
+
return (0, import_vue_demi21.h)(
|
|
832
851
|
(_a2 = props.as) != null ? _a2 : DEFAULT_ELEMENT_TYPE,
|
|
833
852
|
{
|
|
834
|
-
...(0,
|
|
853
|
+
...(0, import_canvas9.getParameterAttributes)({
|
|
835
854
|
component: componentData,
|
|
836
855
|
id: props.parameterId,
|
|
837
856
|
isMultiline: props.isMultiline
|
|
838
857
|
}),
|
|
839
|
-
[
|
|
840
|
-
[
|
|
841
|
-
[
|
|
858
|
+
[import_canvas7.ATTRIBUTE_PARAMETER_VALUE]: (_b = value.value) != null ? _b : "",
|
|
859
|
+
[import_canvas7.ATTRIBUTE_PARAMETER_TYPE]: "text",
|
|
860
|
+
[import_canvas7.ATTRIBUTE_PLACEHOLDER]: computedPlaceholder,
|
|
842
861
|
style: props.isMultiline ? { whiteSpace: "pre-wrap" } : {},
|
|
843
862
|
onFocus: handleOnFocus,
|
|
844
863
|
onBlur: handleOnBlur
|
|
@@ -850,8 +869,8 @@ var UniformText = (0, import_vue_demi20.defineComponent)({
|
|
|
850
869
|
});
|
|
851
870
|
|
|
852
871
|
// src/composables/useCompositionEventEffect.ts
|
|
853
|
-
var
|
|
854
|
-
var
|
|
872
|
+
var import_canvas8 = require("@uniformdev/canvas");
|
|
873
|
+
var import_vue_demi22 = require("vue-demi");
|
|
855
874
|
async function useCompositionEventEffect({
|
|
856
875
|
enabled,
|
|
857
876
|
projectId,
|
|
@@ -859,19 +878,19 @@ async function useCompositionEventEffect({
|
|
|
859
878
|
effect
|
|
860
879
|
}) {
|
|
861
880
|
let unsubscribe;
|
|
862
|
-
(0,
|
|
881
|
+
(0, import_vue_demi22.watch)(
|
|
863
882
|
[() => enabled, () => compositionIdRef.value, () => projectId],
|
|
864
883
|
async () => {
|
|
865
884
|
unsubscribe == null ? void 0 : unsubscribe();
|
|
866
885
|
if (!enabled || !compositionIdRef.value || !projectId) {
|
|
867
886
|
return;
|
|
868
887
|
}
|
|
869
|
-
const eventBus = await (0,
|
|
888
|
+
const eventBus = await (0, import_canvas8.createEventBus)();
|
|
870
889
|
if (eventBus) {
|
|
871
|
-
unsubscribe = (0,
|
|
890
|
+
unsubscribe = (0, import_canvas8.subscribeToComposition)({
|
|
872
891
|
eventBus,
|
|
873
892
|
compositionId: compositionIdRef.value,
|
|
874
|
-
compositionState:
|
|
893
|
+
compositionState: import_canvas8.CANVAS_DRAFT_STATE,
|
|
875
894
|
projectId,
|
|
876
895
|
callback: effect,
|
|
877
896
|
event: "updated"
|
|
@@ -883,7 +902,7 @@ async function useCompositionEventEffect({
|
|
|
883
902
|
}
|
|
884
903
|
|
|
885
904
|
// src/helpers/getParameterAttributes.ts
|
|
886
|
-
var
|
|
905
|
+
var import_canvas9 = require("@uniformdev/canvas");
|
|
887
906
|
// Annotate the CommonJS export names for ESM import in node:
|
|
888
907
|
0 && (module.exports = {
|
|
889
908
|
DefaultNotImplementedComponent,
|
|
@@ -897,6 +916,7 @@ var import_canvas8 = require("@uniformdev/canvas");
|
|
|
897
916
|
TextRichTextNode,
|
|
898
917
|
UniformComponent,
|
|
899
918
|
UniformComposition,
|
|
919
|
+
UniformPlayground,
|
|
900
920
|
UniformRichText,
|
|
901
921
|
UniformRichTextNode,
|
|
902
922
|
UniformSlot,
|