@uniformdev/canvas-react 19.135.1-alpha.10 → 19.135.1-alpha.12
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 +223 -89
- package/dist/index.d.ts +223 -89
- package/dist/index.esm.js +106 -55
- package/dist/index.js +193 -143
- package/dist/index.mjs +106 -55
- package/package.json +11 -9
package/dist/index.js
CHANGED
|
@@ -46,7 +46,7 @@ __export(src_exports, {
|
|
|
46
46
|
convertComponentToProps: () => convertComponentToProps,
|
|
47
47
|
createComponentStore: () => createComponentStore,
|
|
48
48
|
createComponentStoreResolver: () => createComponentStoreResolver,
|
|
49
|
-
createUniformApiEnhancer: () =>
|
|
49
|
+
createUniformApiEnhancer: () => import_canvas6.createUniformApiEnhancer,
|
|
50
50
|
getParameterAttributes: () => getParameterAttributes,
|
|
51
51
|
registerUniformComponent: () => registerUniformComponent,
|
|
52
52
|
useCompositionEventEffect: () => useCompositionEventEffect,
|
|
@@ -131,9 +131,9 @@ registerUniformComponent({ type: "${componentType}", component: ${proposedFileNa
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
// src/components/UniformComponent.tsx
|
|
134
|
-
var
|
|
135
|
-
var
|
|
136
|
-
var
|
|
134
|
+
var import_canvas9 = require("@uniformdev/canvas");
|
|
135
|
+
var import_context_react3 = require("@uniformdev/context-react");
|
|
136
|
+
var import_react9 = __toESM(require("react"));
|
|
137
137
|
|
|
138
138
|
// src/helpers/convertComponentToProps.ts
|
|
139
139
|
function convertComponentToProps(component) {
|
|
@@ -192,8 +192,8 @@ var componentStoreResolver = createComponentStoreResolver({
|
|
|
192
192
|
});
|
|
193
193
|
|
|
194
194
|
// src/components/UniformSlot.tsx
|
|
195
|
-
var
|
|
196
|
-
var
|
|
195
|
+
var import_canvas8 = require("@uniformdev/canvas");
|
|
196
|
+
var import_react8 = __toESM(require("react"));
|
|
197
197
|
|
|
198
198
|
// src/defaultSystemComponentResolver.tsx
|
|
199
199
|
var import_canvas2 = require("@uniformdev/canvas");
|
|
@@ -234,8 +234,8 @@ var defaultSystemComponentResolver = {
|
|
|
234
234
|
};
|
|
235
235
|
|
|
236
236
|
// src/components/ContextualEditingComponentWrapper.tsx
|
|
237
|
-
var
|
|
238
|
-
var
|
|
237
|
+
var import_canvas7 = require("@uniformdev/canvas");
|
|
238
|
+
var import_react7 = __toESM(require("react"));
|
|
239
239
|
|
|
240
240
|
// src/components/PureContextualEditingComponentWrapper.tsx
|
|
241
241
|
var import_canvas3 = require("@uniformdev/canvas");
|
|
@@ -271,31 +271,71 @@ var PureContextualEditingComponentWrapper = ({
|
|
|
271
271
|
};
|
|
272
272
|
|
|
273
273
|
// src/components/UniformComposition.tsx
|
|
274
|
-
var
|
|
274
|
+
var import_react6 = __toESM(require("react"));
|
|
275
275
|
|
|
276
|
-
// src/hooks/
|
|
276
|
+
// src/hooks/useClientConditionsComposition.ts
|
|
277
|
+
var import_canvas5 = require("@uniformdev/canvas");
|
|
278
|
+
var import_immer = require("immer");
|
|
279
|
+
var import_react4 = require("react");
|
|
280
|
+
|
|
281
|
+
// src/hooks/useClientVisibilityRules.ts
|
|
277
282
|
var import_canvas4 = require("@uniformdev/canvas");
|
|
283
|
+
var import_context_react2 = require("@uniformdev/context-react");
|
|
278
284
|
var import_react3 = require("react");
|
|
285
|
+
function useClientVisibilityRules() {
|
|
286
|
+
const quirks = (0, import_context_react2.useQuirks)({ throwOnMissingProvider: false });
|
|
287
|
+
return (0, import_react3.useMemo)(() => {
|
|
288
|
+
return {
|
|
289
|
+
...(0, import_canvas4.createQuirksVisibilityRule)(quirks)
|
|
290
|
+
};
|
|
291
|
+
}, [quirks]);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// src/hooks/useClientConditionsComposition.ts
|
|
295
|
+
function useClientConditionsComposition(data) {
|
|
296
|
+
const rules = useClientVisibilityRules();
|
|
297
|
+
const preprocessedValue = (0, import_react4.useMemo)(() => {
|
|
298
|
+
if (!data) {
|
|
299
|
+
return data;
|
|
300
|
+
}
|
|
301
|
+
try {
|
|
302
|
+
return (0, import_immer.produce)(data, (draft) => {
|
|
303
|
+
(0, import_canvas5.walkNodeTree)(draft, (context) => {
|
|
304
|
+
(0, import_canvas5.evaluateWalkTreeNodeVisibility)({ context, rules, showIndeterminate: false });
|
|
305
|
+
(0, import_canvas5.evaluateWalkTreePropertyCriteria)({ node: context.node, rules, keepIndeterminate: false });
|
|
306
|
+
});
|
|
307
|
+
});
|
|
308
|
+
} catch (e) {
|
|
309
|
+
console.error("Error evaluating visibility rules:", e.stack);
|
|
310
|
+
return data;
|
|
311
|
+
}
|
|
312
|
+
}, [data, rules]);
|
|
313
|
+
return preprocessedValue;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// src/hooks/useUniformContextualEditing.ts
|
|
317
|
+
var import_canvas6 = require("@uniformdev/canvas");
|
|
318
|
+
var import_react5 = require("react");
|
|
279
319
|
var registeredCompositionIds = /* @__PURE__ */ new Set();
|
|
280
320
|
var useUniformContextualEditing = ({
|
|
281
321
|
initialCompositionValue,
|
|
282
322
|
enhance = (message) => message.composition
|
|
283
323
|
}) => {
|
|
284
|
-
const [contextualComposition, setContextualComposition] = (0,
|
|
285
|
-
const latestEventTimeStamp = (0,
|
|
286
|
-
const channel = (0,
|
|
324
|
+
const [contextualComposition, setContextualComposition] = (0, import_react5.useState)();
|
|
325
|
+
const latestEventTimeStamp = (0, import_react5.useRef)();
|
|
326
|
+
const channel = (0, import_react5.useMemo)(() => {
|
|
287
327
|
var _a;
|
|
288
328
|
if (!isInContextEditingMode()) {
|
|
289
329
|
return;
|
|
290
330
|
}
|
|
291
|
-
const channel2 = (0,
|
|
331
|
+
const channel2 = (0, import_canvas6.createCanvasChannel)({
|
|
292
332
|
broadcastTo: [(_a = window.opener) != null ? _a : window.top],
|
|
293
333
|
listenTo: [window]
|
|
294
334
|
});
|
|
295
335
|
return channel2;
|
|
296
336
|
}, []);
|
|
297
|
-
(0,
|
|
298
|
-
if ((contextualComposition == null ? void 0 : contextualComposition._id) && (initialCompositionValue == null ? void 0 : initialCompositionValue._id) !==
|
|
337
|
+
(0, import_react5.useEffect)(() => {
|
|
338
|
+
if ((contextualComposition == null ? void 0 : contextualComposition._id) && (initialCompositionValue == null ? void 0 : initialCompositionValue._id) !== import_canvas6.EMPTY_COMPOSITION._id && (initialCompositionValue == null ? void 0 : initialCompositionValue._id) !== (contextualComposition == null ? void 0 : contextualComposition._id)) {
|
|
299
339
|
setContextualComposition(void 0);
|
|
300
340
|
return;
|
|
301
341
|
}
|
|
@@ -303,7 +343,7 @@ var useUniformContextualEditing = ({
|
|
|
303
343
|
return;
|
|
304
344
|
}
|
|
305
345
|
const unsubscribeFromCompositionUpdates = channel.on("update-composition-internal", async (message) => {
|
|
306
|
-
if (!(0,
|
|
346
|
+
if (!(0, import_canvas6.isUpdateCompositionInternalMessage)(message)) {
|
|
307
347
|
return;
|
|
308
348
|
}
|
|
309
349
|
if (latestEventTimeStamp.current && message.eventTimestamp && message.eventTimestamp <= latestEventTimeStamp.current) {
|
|
@@ -319,11 +359,11 @@ var useUniformContextualEditing = ({
|
|
|
319
359
|
registeredCompositionIds.delete(initialCompositionValue == null ? void 0 : initialCompositionValue._id);
|
|
320
360
|
};
|
|
321
361
|
}, [channel, enhance, initialCompositionValue == null ? void 0 : initialCompositionValue._id, contextualComposition == null ? void 0 : contextualComposition._id]);
|
|
322
|
-
(0,
|
|
362
|
+
(0, import_react5.useEffect)(() => {
|
|
323
363
|
if (!isInContextEditingMode()) {
|
|
324
364
|
return;
|
|
325
365
|
}
|
|
326
|
-
const existingScript = document.getElementById(
|
|
366
|
+
const existingScript = document.getElementById(import_canvas6.IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID);
|
|
327
367
|
if (existingScript) {
|
|
328
368
|
return;
|
|
329
369
|
}
|
|
@@ -333,7 +373,7 @@ var useUniformContextualEditing = ({
|
|
|
333
373
|
version: 2
|
|
334
374
|
};
|
|
335
375
|
const script = document.createElement("script");
|
|
336
|
-
script.id =
|
|
376
|
+
script.id = import_canvas6.IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID;
|
|
337
377
|
script.src = getCanvasInContextEmbedScriptUrl();
|
|
338
378
|
script.async = true;
|
|
339
379
|
document.head.appendChild(script);
|
|
@@ -352,18 +392,18 @@ function isInContextEditingMode() {
|
|
|
352
392
|
return false;
|
|
353
393
|
}
|
|
354
394
|
const isOpenedByInContextEditor = new URLSearchParams(window.location.search).has(
|
|
355
|
-
|
|
395
|
+
import_canvas6.IN_CONTEXT_EDITOR_QUERY_STRING_PARAM
|
|
356
396
|
);
|
|
357
|
-
return isOpenedByInContextEditor && (0,
|
|
397
|
+
return isOpenedByInContextEditor && (0, import_canvas6.isAllowedReferrer)(window.document.referrer);
|
|
358
398
|
}
|
|
359
399
|
|
|
360
400
|
// src/components/UniformComposition.tsx
|
|
361
|
-
var UniformCompositionContext = (0,
|
|
401
|
+
var UniformCompositionContext = (0, import_react6.createContext)({
|
|
362
402
|
data: void 0,
|
|
363
403
|
isContextualEditing: false
|
|
364
404
|
});
|
|
365
405
|
function useUniformCurrentComposition() {
|
|
366
|
-
return (0,
|
|
406
|
+
return (0, import_react6.useContext)(UniformCompositionContext);
|
|
367
407
|
}
|
|
368
408
|
function UniformComposition({
|
|
369
409
|
data,
|
|
@@ -373,16 +413,17 @@ function UniformComposition({
|
|
|
373
413
|
contextualEditingEnhancer,
|
|
374
414
|
contextualEditingDefaultPlaceholder
|
|
375
415
|
}) {
|
|
416
|
+
const ruledComposition = useClientConditionsComposition(data);
|
|
376
417
|
const { composition, isContextualEditing } = useUniformContextualEditing({
|
|
377
|
-
initialCompositionValue:
|
|
418
|
+
initialCompositionValue: ruledComposition,
|
|
378
419
|
enhance: contextualEditingEnhancer
|
|
379
420
|
});
|
|
380
|
-
return /* @__PURE__ */
|
|
421
|
+
return /* @__PURE__ */ import_react6.default.createElement(
|
|
381
422
|
UniformCompositionContext.Provider,
|
|
382
423
|
{
|
|
383
424
|
value: { data: composition, behaviorTracking, resolveRenderer, isContextualEditing }
|
|
384
425
|
},
|
|
385
|
-
/* @__PURE__ */
|
|
426
|
+
/* @__PURE__ */ import_react6.default.createElement(ContextualEditingComponentWrapper, { component: composition }, /* @__PURE__ */ import_react6.default.createElement(
|
|
386
427
|
UniformComponent,
|
|
387
428
|
{
|
|
388
429
|
data: composition,
|
|
@@ -406,16 +447,16 @@ function ContextualEditingComponentWrapper({
|
|
|
406
447
|
children
|
|
407
448
|
}) {
|
|
408
449
|
var _a;
|
|
409
|
-
const isPlaceholder = (0,
|
|
450
|
+
const isPlaceholder = (0, import_canvas7.isComponentPlaceholderId)(component == null ? void 0 : component._id);
|
|
410
451
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
411
452
|
const isReadOnly = ((_a = component == null ? void 0 : component._contextualEditing) == null ? void 0 : _a.isEditable) ? void 0 : "true";
|
|
412
453
|
if (!isContextualEditing) {
|
|
413
|
-
return /* @__PURE__ */
|
|
454
|
+
return /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, children);
|
|
414
455
|
}
|
|
415
456
|
if (isPlaceholder && emptyPlaceholder === null) {
|
|
416
457
|
return null;
|
|
417
458
|
}
|
|
418
|
-
return /* @__PURE__ */
|
|
459
|
+
return /* @__PURE__ */ import_react7.default.createElement(
|
|
419
460
|
PureContextualEditingComponentWrapper,
|
|
420
461
|
{
|
|
421
462
|
isPlaceholder,
|
|
@@ -445,7 +486,7 @@ function UniformSlot({
|
|
|
445
486
|
}
|
|
446
487
|
const slot = (_a = parentData.slots) == null ? void 0 : _a[name];
|
|
447
488
|
if (!slot || !Array.isArray(slot)) {
|
|
448
|
-
if (process.env.NODE_ENV === "development" && parentData.type !==
|
|
489
|
+
if (process.env.NODE_ENV === "development" && parentData.type !== import_canvas8.EMPTY_COMPOSITION.type) {
|
|
449
490
|
console.warn(
|
|
450
491
|
`[canvas-dev] slot '${name}' was rendered, but it was not defined on its component. This is expected if the slot is optional, otherwise it may indicate a typo. Component:`,
|
|
451
492
|
parentData
|
|
@@ -466,13 +507,13 @@ function UniformSlot({
|
|
|
466
507
|
emptyPlaceholder
|
|
467
508
|
});
|
|
468
509
|
const elements = children ? children({ child, component, key: `wrapped-inner-${index}` }) : child;
|
|
469
|
-
return
|
|
510
|
+
return import_react8.default.createElement(import_react8.default.Fragment, { key: index }, elements);
|
|
470
511
|
});
|
|
471
512
|
if (!wrapperComponent) {
|
|
472
|
-
return
|
|
513
|
+
return import_react8.default.createElement(import_react8.default.Fragment, void 0, finalChildren);
|
|
473
514
|
}
|
|
474
515
|
const Wrapper = wrapperComponent;
|
|
475
|
-
return /* @__PURE__ */
|
|
516
|
+
return /* @__PURE__ */ import_react8.default.createElement(Wrapper, { items: finalChildren, slotName: name });
|
|
476
517
|
}
|
|
477
518
|
function renderComponent({
|
|
478
519
|
component,
|
|
@@ -485,7 +526,7 @@ function renderComponent({
|
|
|
485
526
|
emptyPlaceholder
|
|
486
527
|
}) {
|
|
487
528
|
const RenderComponent = resolveRenderer == null ? void 0 : resolveRenderer(component);
|
|
488
|
-
if (component.type ===
|
|
529
|
+
if (component.type === import_canvas8.CANVAS_TEST_TYPE) {
|
|
489
530
|
const testComponent = defaultSystemComponentResolver.test(
|
|
490
531
|
component,
|
|
491
532
|
key,
|
|
@@ -496,15 +537,15 @@ function renderComponent({
|
|
|
496
537
|
resolveRenderer,
|
|
497
538
|
key: key2,
|
|
498
539
|
parentComponent: component,
|
|
499
|
-
slotName:
|
|
500
|
-
slotChildrenCount: (_a = component == null ? void 0 : component.slots) == null ? void 0 : _a[
|
|
501
|
-
indexInSlot: (_b = component == null ? void 0 : component.slots) == null ? void 0 : _b[
|
|
540
|
+
slotName: import_canvas8.CANVAS_TEST_SLOT,
|
|
541
|
+
slotChildrenCount: (_a = component == null ? void 0 : component.slots) == null ? void 0 : _a[import_canvas8.CANVAS_TEST_SLOT].length,
|
|
542
|
+
indexInSlot: (_b = component == null ? void 0 : component.slots) == null ? void 0 : _b[import_canvas8.CANVAS_TEST_SLOT].findIndex(
|
|
502
543
|
({ _id }) => variantComponent._id === _id
|
|
503
544
|
)
|
|
504
545
|
});
|
|
505
546
|
}
|
|
506
547
|
);
|
|
507
|
-
return /* @__PURE__ */
|
|
548
|
+
return /* @__PURE__ */ import_react8.default.createElement(
|
|
508
549
|
ContextualEditingComponentWrapper,
|
|
509
550
|
{
|
|
510
551
|
component,
|
|
@@ -516,7 +557,7 @@ function renderComponent({
|
|
|
516
557
|
},
|
|
517
558
|
testComponent
|
|
518
559
|
);
|
|
519
|
-
} else if (component.type ===
|
|
560
|
+
} else if (component.type === import_canvas8.CANVAS_PERSONALIZE_TYPE) {
|
|
520
561
|
const personalizationComponent = defaultSystemComponentResolver.personalization(
|
|
521
562
|
component,
|
|
522
563
|
key,
|
|
@@ -527,15 +568,15 @@ function renderComponent({
|
|
|
527
568
|
resolveRenderer,
|
|
528
569
|
key: key2,
|
|
529
570
|
parentComponent: component,
|
|
530
|
-
slotName:
|
|
531
|
-
slotChildrenCount: (_a = component == null ? void 0 : component.slots) == null ? void 0 : _a[
|
|
532
|
-
indexInSlot: (_b = component == null ? void 0 : component.slots) == null ? void 0 : _b[
|
|
571
|
+
slotName: import_canvas8.CANVAS_PERSONALIZE_SLOT,
|
|
572
|
+
slotChildrenCount: (_a = component == null ? void 0 : component.slots) == null ? void 0 : _a[import_canvas8.CANVAS_PERSONALIZE_SLOT].length,
|
|
573
|
+
indexInSlot: (_b = component == null ? void 0 : component.slots) == null ? void 0 : _b[import_canvas8.CANVAS_PERSONALIZE_SLOT].findIndex(
|
|
533
574
|
({ _id }) => variantComponent._id === _id
|
|
534
575
|
)
|
|
535
576
|
});
|
|
536
577
|
}
|
|
537
578
|
);
|
|
538
|
-
return /* @__PURE__ */
|
|
579
|
+
return /* @__PURE__ */ import_react8.default.createElement(
|
|
539
580
|
ContextualEditingComponentWrapper,
|
|
540
581
|
{
|
|
541
582
|
component,
|
|
@@ -549,7 +590,7 @@ function renderComponent({
|
|
|
549
590
|
);
|
|
550
591
|
} else if (RenderComponent) {
|
|
551
592
|
const props = convertComponentToProps(component);
|
|
552
|
-
return /* @__PURE__ */
|
|
593
|
+
return /* @__PURE__ */ import_react8.default.createElement(UniformComponent, { key, data: component, resolveRenderer }, /* @__PURE__ */ import_react8.default.createElement(
|
|
553
594
|
ContextualEditingComponentWrapper,
|
|
554
595
|
{
|
|
555
596
|
component,
|
|
@@ -559,7 +600,7 @@ function renderComponent({
|
|
|
559
600
|
slotChildrenCount,
|
|
560
601
|
emptyPlaceholder
|
|
561
602
|
},
|
|
562
|
-
/* @__PURE__ */
|
|
603
|
+
/* @__PURE__ */ import_react8.default.createElement(RenderComponent, { ...props })
|
|
563
604
|
));
|
|
564
605
|
} else if (process.env.NODE_ENV !== "production") {
|
|
565
606
|
console.warn(
|
|
@@ -572,9 +613,9 @@ function renderComponent({
|
|
|
572
613
|
}
|
|
573
614
|
|
|
574
615
|
// src/components/UniformComponent.tsx
|
|
575
|
-
var UniformComponentContext = (0,
|
|
616
|
+
var UniformComponentContext = (0, import_react9.createContext)({});
|
|
576
617
|
function useUniformCurrentComponent() {
|
|
577
|
-
return (0,
|
|
618
|
+
return (0, import_react9.useContext)(UniformComponentContext);
|
|
578
619
|
}
|
|
579
620
|
function UniformComponent({
|
|
580
621
|
data,
|
|
@@ -585,7 +626,7 @@ function UniformComponent({
|
|
|
585
626
|
}) {
|
|
586
627
|
var _a, _b, _c;
|
|
587
628
|
const parentData = useUniformCurrentComponent();
|
|
588
|
-
const contextContextProviderPresent = (0,
|
|
629
|
+
const contextContextProviderPresent = (0, import_context_react3.useUniformContext)({ throwOnMissingProvider: false }) !== void 0;
|
|
589
630
|
if (!data) {
|
|
590
631
|
if (process.env.NODE_ENV === "development") {
|
|
591
632
|
console.warn(`[canvas-dev] UniformComponent was rendered with no data, nothing will be output.`);
|
|
@@ -598,17 +639,17 @@ function UniformComponent({
|
|
|
598
639
|
behaviorTracking: (_a = behaviorTracking != null ? behaviorTracking : parentData == null ? void 0 : parentData.behaviorTracking) != null ? _a : "onView",
|
|
599
640
|
contextualEditingDefaultPlaceholder: contextualEditingDefaultPlaceholder != null ? contextualEditingDefaultPlaceholder : parentData.contextualEditingDefaultPlaceholder
|
|
600
641
|
};
|
|
601
|
-
const enrichmentTags = (_c = (_b = data.parameters) == null ? void 0 : _b[
|
|
602
|
-
const TrackComponent = contextValue.behaviorTracking === "onLoad" ?
|
|
642
|
+
const enrichmentTags = (_c = (_b = data.parameters) == null ? void 0 : _b[import_canvas9.CANVAS_ENRICHMENT_TAG_PARAM]) == null ? void 0 : _c.value;
|
|
643
|
+
const TrackComponent = contextValue.behaviorTracking === "onLoad" ? import_context_react3.TrackFragment : import_context_react3.Track;
|
|
603
644
|
const resolvedChildren = resolveChildren({
|
|
604
645
|
children,
|
|
605
646
|
data,
|
|
606
647
|
hasParentLayout: Boolean(parentData.data),
|
|
607
648
|
resolveRenderer: contextValue.resolveRenderer
|
|
608
649
|
});
|
|
609
|
-
return /* @__PURE__ */
|
|
650
|
+
return /* @__PURE__ */ import_react9.default.createElement(UniformComponentContext.Provider, { value: contextValue }, contextContextProviderPresent ? (
|
|
610
651
|
/* auto-track behavior signals when in a Canvas context */
|
|
611
|
-
/* @__PURE__ */
|
|
652
|
+
/* @__PURE__ */ import_react9.default.createElement(TrackComponent, { behavior: enrichmentTags }, resolvedChildren)
|
|
612
653
|
) : resolvedChildren);
|
|
613
654
|
}
|
|
614
655
|
function resolveChildren({
|
|
@@ -621,14 +662,14 @@ function resolveChildren({
|
|
|
621
662
|
if (!children && !hasParentLayout) {
|
|
622
663
|
const topLevelComponent = resolveRenderer({ type: data.type });
|
|
623
664
|
if (topLevelComponent) {
|
|
624
|
-
children =
|
|
665
|
+
children = import_react9.default.createElement(topLevelComponent, convertComponentToProps(data));
|
|
625
666
|
} else {
|
|
626
667
|
if (Object.keys((_a = data.slots) != null ? _a : {}).length > 1 && process.env.NODE_ENV === "development") {
|
|
627
668
|
console.warn(
|
|
628
669
|
`[canvas-dev] All the slots in component '${data.type}' are rendered in no particular order. Use '<UniformSlot name={slotName} />' to reliably render the slots.`
|
|
629
670
|
);
|
|
630
671
|
}
|
|
631
|
-
children = Object.keys(data.slots || {}).map((slotName) => /* @__PURE__ */
|
|
672
|
+
children = Object.keys(data.slots || {}).map((slotName) => /* @__PURE__ */ import_react9.default.createElement(UniformSlot, { key: slotName, name: slotName }));
|
|
632
673
|
}
|
|
633
674
|
}
|
|
634
675
|
const renderChildren = typeof children === "function" ? children(convertComponentToProps(data)) : children;
|
|
@@ -636,47 +677,38 @@ function resolveChildren({
|
|
|
636
677
|
}
|
|
637
678
|
|
|
638
679
|
// src/components/UniformPlayground.tsx
|
|
639
|
-
var
|
|
640
|
-
var
|
|
680
|
+
var import_canvas10 = require("@uniformdev/canvas");
|
|
681
|
+
var import_react10 = __toESM(require("react"));
|
|
641
682
|
var UniformPlayground = ({
|
|
642
683
|
resolveRenderer,
|
|
643
684
|
decorators = [],
|
|
644
685
|
contextualEditingEnhancer,
|
|
645
686
|
behaviorTracking,
|
|
646
|
-
contextualEditingDefaultPlaceholder
|
|
647
|
-
children
|
|
687
|
+
contextualEditingDefaultPlaceholder
|
|
648
688
|
}) => {
|
|
649
689
|
const { composition, isContextualEditing } = useUniformContextualEditing({
|
|
650
|
-
initialCompositionValue:
|
|
690
|
+
initialCompositionValue: import_canvas10.EMPTY_COMPOSITION,
|
|
651
691
|
enhance: contextualEditingEnhancer
|
|
652
692
|
});
|
|
653
|
-
const renderedComponent = (0,
|
|
693
|
+
const renderedComponent = (0, import_react10.useMemo)(() => {
|
|
654
694
|
if (!composition) {
|
|
655
695
|
return null;
|
|
656
696
|
}
|
|
657
|
-
let component = /* @__PURE__ */
|
|
697
|
+
let component = /* @__PURE__ */ import_react10.default.createElement(ContextualEditingComponentWrapper, { component: composition }, /* @__PURE__ */ import_react10.default.createElement(
|
|
658
698
|
UniformComponent,
|
|
659
699
|
{
|
|
660
700
|
data: composition,
|
|
661
701
|
behaviorTracking,
|
|
662
702
|
resolveRenderer,
|
|
663
703
|
contextualEditingDefaultPlaceholder
|
|
664
|
-
}
|
|
665
|
-
children
|
|
704
|
+
}
|
|
666
705
|
));
|
|
667
706
|
decorators.forEach((Decorator) => {
|
|
668
|
-
component = /* @__PURE__ */
|
|
707
|
+
component = /* @__PURE__ */ import_react10.default.createElement(Decorator, { data: composition }, component);
|
|
669
708
|
});
|
|
670
709
|
return component;
|
|
671
|
-
}, [
|
|
672
|
-
|
|
673
|
-
resolveRenderer,
|
|
674
|
-
decorators,
|
|
675
|
-
composition,
|
|
676
|
-
behaviorTracking,
|
|
677
|
-
contextualEditingDefaultPlaceholder
|
|
678
|
-
]);
|
|
679
|
-
return /* @__PURE__ */ import_react8.default.createElement(
|
|
710
|
+
}, [resolveRenderer, decorators, composition, behaviorTracking, contextualEditingDefaultPlaceholder]);
|
|
711
|
+
return /* @__PURE__ */ import_react10.default.createElement(
|
|
680
712
|
UniformCompositionContext.Provider,
|
|
681
713
|
{
|
|
682
714
|
value: { data: composition, behaviorTracking, resolveRenderer, isContextualEditing }
|
|
@@ -686,57 +718,57 @@ var UniformPlayground = ({
|
|
|
686
718
|
};
|
|
687
719
|
|
|
688
720
|
// src/components/UniformRichText/UniformRichText.tsx
|
|
689
|
-
var
|
|
690
|
-
var
|
|
691
|
-
var
|
|
721
|
+
var import_canvas11 = require("@uniformdev/canvas");
|
|
722
|
+
var import_richtext6 = require("@uniformdev/richtext");
|
|
723
|
+
var import_react21 = __toESM(require("react"));
|
|
692
724
|
|
|
693
725
|
// src/components/UniformRichText/UniformRichTextNode.tsx
|
|
694
|
-
var
|
|
695
|
-
var
|
|
726
|
+
var import_richtext5 = require("@uniformdev/richtext");
|
|
727
|
+
var import_react20 = __toESM(require("react"));
|
|
696
728
|
|
|
697
729
|
// src/components/UniformRichText/nodes/HeadingRichTextNode.tsx
|
|
698
|
-
var
|
|
730
|
+
var import_react11 = __toESM(require("react"));
|
|
699
731
|
var HeadingRichTextNode = ({ children, node }) => {
|
|
700
732
|
const { tag } = node;
|
|
701
733
|
const HTag = tag != null ? tag : "h1";
|
|
702
|
-
return /* @__PURE__ */
|
|
734
|
+
return /* @__PURE__ */ import_react11.default.createElement(HTag, null, children);
|
|
703
735
|
};
|
|
704
736
|
|
|
705
737
|
// src/components/UniformRichText/nodes/LinebreakRichTextNode.tsx
|
|
706
|
-
var
|
|
738
|
+
var import_react12 = __toESM(require("react"));
|
|
707
739
|
var LinebreakRichTextNode = () => {
|
|
708
|
-
return /* @__PURE__ */
|
|
740
|
+
return /* @__PURE__ */ import_react12.default.createElement("br", null);
|
|
709
741
|
};
|
|
710
742
|
|
|
711
743
|
// src/components/UniformRichText/nodes/LinkRichTextNode.tsx
|
|
712
744
|
var import_richtext = require("@uniformdev/richtext");
|
|
713
|
-
var
|
|
745
|
+
var import_react13 = __toESM(require("react"));
|
|
714
746
|
var LinkRichTextNode = ({ children, node }) => {
|
|
715
747
|
const { link } = node;
|
|
716
|
-
return /* @__PURE__ */
|
|
748
|
+
return /* @__PURE__ */ import_react13.default.createElement("a", { href: (0, import_richtext.linkParamValueToHref)(link) }, children);
|
|
717
749
|
};
|
|
718
750
|
|
|
719
751
|
// src/components/UniformRichText/nodes/ListItemRichTextNode.tsx
|
|
720
|
-
var
|
|
752
|
+
var import_react14 = __toESM(require("react"));
|
|
721
753
|
var ListItemRichTextNode = ({ children, node }) => {
|
|
722
754
|
const { value } = node;
|
|
723
|
-
return /* @__PURE__ */
|
|
755
|
+
return /* @__PURE__ */ import_react14.default.createElement("li", { value: Number.isFinite(value) && value > 0 ? value : void 0 }, children);
|
|
724
756
|
};
|
|
725
757
|
|
|
726
758
|
// src/components/UniformRichText/nodes/ListRichTextNode.tsx
|
|
727
|
-
var
|
|
759
|
+
var import_react15 = __toESM(require("react"));
|
|
728
760
|
var ListRichTextNode = ({ children, node }) => {
|
|
729
761
|
const { tag, start } = node;
|
|
730
762
|
const ListTag = tag != null ? tag : "ul";
|
|
731
|
-
return /* @__PURE__ */
|
|
763
|
+
return /* @__PURE__ */ import_react15.default.createElement(ListTag, { start: Number.isFinite(start) && start > 0 ? start : void 0 }, children);
|
|
732
764
|
};
|
|
733
765
|
|
|
734
766
|
// src/components/UniformRichText/nodes/ParagraphRichTextNode.tsx
|
|
735
767
|
var import_richtext2 = require("@uniformdev/richtext");
|
|
736
|
-
var
|
|
768
|
+
var import_react16 = __toESM(require("react"));
|
|
737
769
|
var ParagraphRichTextNode = ({ children, node }) => {
|
|
738
770
|
const { format, direction } = node;
|
|
739
|
-
return /* @__PURE__ */
|
|
771
|
+
return /* @__PURE__ */ import_react16.default.createElement(
|
|
740
772
|
"p",
|
|
741
773
|
{
|
|
742
774
|
dir: (0, import_richtext2.isPureDirection)(direction) ? direction : void 0,
|
|
@@ -746,26 +778,34 @@ var ParagraphRichTextNode = ({ children, node }) => {
|
|
|
746
778
|
);
|
|
747
779
|
};
|
|
748
780
|
|
|
781
|
+
// src/components/UniformRichText/nodes/TableCellRichTextNode.tsx
|
|
782
|
+
var import_richtext3 = require("@uniformdev/richtext");
|
|
783
|
+
var import_react17 = __toESM(require("react"));
|
|
784
|
+
var TableCellRichTextNode = ({ children, node }) => {
|
|
785
|
+
const { headerState } = node;
|
|
786
|
+
const TableCellTag = (0, import_richtext3.getRichTextTagFromTableCellHeaderState)(headerState);
|
|
787
|
+
return /* @__PURE__ */ import_react17.default.createElement(TableCellTag, null, children);
|
|
788
|
+
};
|
|
789
|
+
|
|
749
790
|
// src/components/UniformRichText/nodes/TabRichTextNode.tsx
|
|
750
|
-
var
|
|
791
|
+
var import_react18 = __toESM(require("react"));
|
|
751
792
|
var TabRichTextNode = () => {
|
|
752
|
-
return /* @__PURE__ */
|
|
793
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_react18.default.Fragment, null, " ");
|
|
753
794
|
};
|
|
754
795
|
|
|
755
796
|
// src/components/UniformRichText/nodes/TextRichTextNode.tsx
|
|
756
|
-
var
|
|
757
|
-
var
|
|
797
|
+
var import_richtext4 = require("@uniformdev/richtext");
|
|
798
|
+
var import_react19 = __toESM(require("react"));
|
|
758
799
|
var TextRichTextNode = ({ node }) => {
|
|
759
800
|
const { text, format } = node;
|
|
760
|
-
const tags = (0,
|
|
761
|
-
return /* @__PURE__ */
|
|
801
|
+
const tags = (0, import_richtext4.getRichTextTagsFromTextFormat)(format);
|
|
802
|
+
return /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, tags.length > 0 ? tags.reduceRight((children, Tag) => /* @__PURE__ */ import_react19.default.createElement(Tag, null, children), text) : text);
|
|
762
803
|
};
|
|
763
804
|
|
|
764
805
|
// src/components/UniformRichText/UniformRichTextNode.tsx
|
|
765
806
|
function UniformRichTextNode({ node, ...props }) {
|
|
766
807
|
var _a;
|
|
767
|
-
if (!(0,
|
|
768
|
-
return null;
|
|
808
|
+
if (!(0, import_richtext5.isRichTextNode)(node)) return null;
|
|
769
809
|
let NodeRenderer = (_a = props.resolveRichTextRenderer) == null ? void 0 : _a.call(props, node);
|
|
770
810
|
if (typeof NodeRenderer === "undefined") {
|
|
771
811
|
NodeRenderer = resolveRichTextDefaultRenderer(node);
|
|
@@ -773,8 +813,8 @@ function UniformRichTextNode({ node, ...props }) {
|
|
|
773
813
|
if (!NodeRenderer) {
|
|
774
814
|
return null;
|
|
775
815
|
}
|
|
776
|
-
const children = node.children ? node.children.map((childNode, i) => /* @__PURE__ */
|
|
777
|
-
return /* @__PURE__ */
|
|
816
|
+
const children = node.children ? node.children.map((childNode, i) => /* @__PURE__ */ import_react20.default.createElement(UniformRichTextNode, { ...props, key: i, node: childNode })) : null;
|
|
817
|
+
return /* @__PURE__ */ import_react20.default.createElement(NodeRenderer, { node }, children);
|
|
778
818
|
}
|
|
779
819
|
var rendererMap = /* @__PURE__ */ new Map([
|
|
780
820
|
["heading", HeadingRichTextNode],
|
|
@@ -783,49 +823,59 @@ var rendererMap = /* @__PURE__ */ new Map([
|
|
|
783
823
|
["list", ListRichTextNode],
|
|
784
824
|
["listitem", ListItemRichTextNode],
|
|
785
825
|
["paragraph", ParagraphRichTextNode],
|
|
786
|
-
["quote", ({ children }) => /* @__PURE__ */
|
|
826
|
+
["quote", ({ children }) => /* @__PURE__ */ import_react20.default.createElement("blockquote", null, children)],
|
|
787
827
|
[
|
|
788
828
|
"code",
|
|
789
|
-
({ children }) => /* @__PURE__ */
|
|
829
|
+
({ children }) => /* @__PURE__ */ import_react20.default.createElement("pre", null, /* @__PURE__ */ import_react20.default.createElement("code", null, children))
|
|
790
830
|
],
|
|
791
|
-
["root", ({ children }) => /* @__PURE__ */
|
|
831
|
+
["root", ({ children }) => /* @__PURE__ */ import_react20.default.createElement(import_react20.default.Fragment, null, children)],
|
|
792
832
|
["text", TextRichTextNode],
|
|
793
|
-
["tab", TabRichTextNode]
|
|
833
|
+
["tab", TabRichTextNode],
|
|
834
|
+
[
|
|
835
|
+
"table",
|
|
836
|
+
({ children }) => /* @__PURE__ */ import_react20.default.createElement("table", null, /* @__PURE__ */ import_react20.default.createElement("tbody", null, children))
|
|
837
|
+
],
|
|
838
|
+
["tablerow", ({ children }) => /* @__PURE__ */ import_react20.default.createElement("tr", null, children)],
|
|
839
|
+
["tablecell", TableCellRichTextNode]
|
|
794
840
|
]);
|
|
795
841
|
var resolveRichTextDefaultRenderer = (node) => {
|
|
796
842
|
return rendererMap.get(node.type);
|
|
797
843
|
};
|
|
798
844
|
|
|
799
845
|
// src/components/UniformRichText/UniformRichText.tsx
|
|
800
|
-
var UniformRichText =
|
|
801
|
-
|
|
802
|
-
const
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
const value = (0, import_react18.useMemo)(() => parameter == null ? void 0 : parameter.value, [parameter]);
|
|
807
|
-
if (!value || !(0, import_richtext5.isRichTextValue)(value) || (0, import_richtext5.isRichTextValueConsideredEmpty)(value))
|
|
846
|
+
var UniformRichText = import_react21.default.forwardRef(function UniformRichText2({ parameterId, resolveRichTextRenderer, as: Tag = "div", placeholder, ...props }, ref) {
|
|
847
|
+
var _a;
|
|
848
|
+
const { data: componentData, contextualEditingDefaultPlaceholder } = useUniformCurrentComponent();
|
|
849
|
+
const { isContextualEditing } = useUniformCurrentComposition();
|
|
850
|
+
const parameter = (_a = componentData == null ? void 0 : componentData.parameters) == null ? void 0 : _a[parameterId];
|
|
851
|
+
if (!parameter) {
|
|
808
852
|
return null;
|
|
809
|
-
|
|
853
|
+
}
|
|
854
|
+
const placeholderProp = placeholder != null ? placeholder : contextualEditingDefaultPlaceholder;
|
|
855
|
+
const computedPlaceholder = typeof placeholderProp === "function" ? placeholderProp({ id: parameterId }) : placeholderProp;
|
|
856
|
+
const value = parameter.value;
|
|
857
|
+
if (!value || !(0, import_richtext6.isRichTextValue)(value)) return null;
|
|
858
|
+
if (!isContextualEditing && (0, import_richtext6.isRichTextValueConsideredEmpty)(value)) return null;
|
|
859
|
+
return Tag === null ? /* @__PURE__ */ import_react21.default.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer }) : /* @__PURE__ */ import_react21.default.createElement(
|
|
810
860
|
Tag,
|
|
811
861
|
{
|
|
812
862
|
ref,
|
|
813
863
|
...props,
|
|
814
|
-
...{
|
|
815
|
-
[
|
|
816
|
-
[
|
|
817
|
-
[
|
|
818
|
-
}
|
|
864
|
+
...isContextualEditing ? {
|
|
865
|
+
[import_canvas11.ATTRIBUTE_COMPONENT_ID]: componentData == null ? void 0 : componentData._id,
|
|
866
|
+
[import_canvas11.ATTRIBUTE_PARAMETER_ID]: parameterId,
|
|
867
|
+
[import_canvas11.ATTRIBUTE_PARAMETER_TYPE]: "richText"
|
|
868
|
+
} : {}
|
|
819
869
|
},
|
|
820
|
-
/* @__PURE__ */
|
|
870
|
+
(0, import_richtext6.isRichTextValueConsideredEmpty)(value) ? /* @__PURE__ */ import_react21.default.createElement("p", null, /* @__PURE__ */ import_react21.default.createElement("i", null, computedPlaceholder)) : /* @__PURE__ */ import_react21.default.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer })
|
|
821
871
|
);
|
|
822
872
|
});
|
|
823
873
|
|
|
824
874
|
// src/components/UniformText.tsx
|
|
825
|
-
var
|
|
875
|
+
var import_react23 = __toESM(require("react"));
|
|
826
876
|
|
|
827
877
|
// src/components/PureUniformText.tsx
|
|
828
|
-
var
|
|
878
|
+
var import_react22 = __toESM(require("react"));
|
|
829
879
|
var PureUniformText = ({
|
|
830
880
|
as: Tag = "span",
|
|
831
881
|
parameterId,
|
|
@@ -844,10 +894,10 @@ var PureUniformText = ({
|
|
|
844
894
|
return null;
|
|
845
895
|
}
|
|
846
896
|
if (!isContextualEditing) {
|
|
847
|
-
return /* @__PURE__ */
|
|
897
|
+
return /* @__PURE__ */ import_react22.default.createElement(Tag, { style: isMultiline ? { whiteSpace: "pre-wrap" } : {}, ...props }, render(value));
|
|
848
898
|
}
|
|
849
899
|
const computedPlaceholder = typeof placeholder === "function" ? placeholder({ id: parameterId }) : placeholder;
|
|
850
|
-
return /* @__PURE__ */
|
|
900
|
+
return /* @__PURE__ */ import_react22.default.createElement(
|
|
851
901
|
Tag,
|
|
852
902
|
{
|
|
853
903
|
...props,
|
|
@@ -876,7 +926,7 @@ var UniformText = ({
|
|
|
876
926
|
var _a, _b, _c;
|
|
877
927
|
const { data: componentData, contextualEditingDefaultPlaceholder } = useUniformCurrentComponent();
|
|
878
928
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
879
|
-
const [isFocused, setIsFocused] = (0,
|
|
929
|
+
const [isFocused, setIsFocused] = (0, import_react23.useState)(false);
|
|
880
930
|
const parameter = (_a = componentData == null ? void 0 : componentData.parameters) == null ? void 0 : _a[parameterId];
|
|
881
931
|
const isEditable = (_c = (_b = parameter == null ? void 0 : parameter._contextualEditing) == null ? void 0 : _b.isEditable) != null ? _c : false;
|
|
882
932
|
const shouldSkipCustomRendering = isFocused && isEditable;
|
|
@@ -885,7 +935,7 @@ var UniformText = ({
|
|
|
885
935
|
}
|
|
886
936
|
const placeholderProp = placeholder != null ? placeholder : contextualEditingDefaultPlaceholder;
|
|
887
937
|
const computedPlaceholder = typeof placeholderProp === "function" ? placeholderProp({ id: parameterId }) : placeholderProp;
|
|
888
|
-
return /* @__PURE__ */
|
|
938
|
+
return /* @__PURE__ */ import_react23.default.createElement(
|
|
889
939
|
PureUniformText,
|
|
890
940
|
{
|
|
891
941
|
...props,
|
|
@@ -908,35 +958,35 @@ var UniformText = ({
|
|
|
908
958
|
};
|
|
909
959
|
|
|
910
960
|
// src/helpers/getParameterAttributes.ts
|
|
911
|
-
var
|
|
961
|
+
var import_canvas12 = require("@uniformdev/canvas");
|
|
912
962
|
var getParameterAttributes = (options) => {
|
|
913
963
|
return {
|
|
914
|
-
...(0,
|
|
964
|
+
...(0, import_canvas12.getParameterAttributes)(options),
|
|
915
965
|
suppressContentEditableWarning: true
|
|
916
966
|
};
|
|
917
967
|
};
|
|
918
968
|
|
|
919
969
|
// src/hooks/useCompositionEventEffect.ts
|
|
920
|
-
var
|
|
921
|
-
var
|
|
970
|
+
var import_canvas13 = require("@uniformdev/canvas");
|
|
971
|
+
var import_react24 = require("react");
|
|
922
972
|
function useCompositionEventEffect({
|
|
923
973
|
enabled,
|
|
924
974
|
projectId,
|
|
925
975
|
compositionId,
|
|
926
976
|
effect
|
|
927
977
|
}) {
|
|
928
|
-
(0,
|
|
978
|
+
(0, import_react24.useEffect)(() => {
|
|
929
979
|
if (!enabled || !compositionId || !projectId) {
|
|
930
980
|
return;
|
|
931
981
|
}
|
|
932
982
|
let goodbye = void 0;
|
|
933
983
|
const loadEffect = async () => {
|
|
934
|
-
const eventBus = await (0,
|
|
984
|
+
const eventBus = await (0, import_canvas13.createEventBus)();
|
|
935
985
|
if (eventBus) {
|
|
936
|
-
goodbye = (0,
|
|
986
|
+
goodbye = (0, import_canvas13.subscribeToComposition)({
|
|
937
987
|
eventBus,
|
|
938
988
|
compositionId,
|
|
939
|
-
compositionState:
|
|
989
|
+
compositionState: import_canvas13.CANVAS_DRAFT_STATE,
|
|
940
990
|
projectId,
|
|
941
991
|
callback: effect,
|
|
942
992
|
event: "updated"
|
|
@@ -953,28 +1003,28 @@ function useCompositionEventEffect({
|
|
|
953
1003
|
}
|
|
954
1004
|
|
|
955
1005
|
// src/hooks/useUniformContextualEditingState.ts
|
|
956
|
-
var
|
|
957
|
-
var
|
|
1006
|
+
var import_canvas14 = require("@uniformdev/canvas");
|
|
1007
|
+
var import_react25 = require("react");
|
|
958
1008
|
var useUniformContextualEditingState = ({
|
|
959
1009
|
global = false
|
|
960
1010
|
} = {}) => {
|
|
961
1011
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
962
1012
|
const { data: componentData } = useUniformCurrentComponent();
|
|
963
|
-
const [selectedComponentReference, setSelectedComponentReference] = (0,
|
|
964
|
-
const [previewMode, setPreviewMode] = (0,
|
|
1013
|
+
const [selectedComponentReference, setSelectedComponentReference] = (0, import_react25.useState)();
|
|
1014
|
+
const [previewMode, setPreviewMode] = (0, import_react25.useState)(
|
|
965
1015
|
isContextualEditing ? "editor" : void 0
|
|
966
1016
|
);
|
|
967
|
-
const channel = (0,
|
|
1017
|
+
const channel = (0, import_react25.useMemo)(() => {
|
|
968
1018
|
if (!isContextualEditing) {
|
|
969
1019
|
return;
|
|
970
1020
|
}
|
|
971
|
-
const channel2 = (0,
|
|
1021
|
+
const channel2 = (0, import_canvas14.createCanvasChannel)({
|
|
972
1022
|
broadcastTo: [window],
|
|
973
1023
|
listenTo: [window]
|
|
974
1024
|
});
|
|
975
1025
|
return channel2;
|
|
976
1026
|
}, [isContextualEditing]);
|
|
977
|
-
(0,
|
|
1027
|
+
(0, import_react25.useEffect)(() => {
|
|
978
1028
|
var _a, _b;
|
|
979
1029
|
if (!channel) {
|
|
980
1030
|
return;
|
|
@@ -984,7 +1034,7 @@ var useUniformContextualEditingState = ({
|
|
|
984
1034
|
}
|
|
985
1035
|
const unsubscribe = channel.on("update-contextual-editing-state-internal", async (message) => {
|
|
986
1036
|
var _a2;
|
|
987
|
-
if (!(0,
|
|
1037
|
+
if (!(0, import_canvas14.isUpdateContextualEditingStateInternalMessage)(message)) {
|
|
988
1038
|
return;
|
|
989
1039
|
}
|
|
990
1040
|
setPreviewMode(message.state.previewMode);
|
|
@@ -998,7 +1048,7 @@ var useUniformContextualEditingState = ({
|
|
|
998
1048
|
unsubscribe();
|
|
999
1049
|
};
|
|
1000
1050
|
}, [global, channel, componentData == null ? void 0 : componentData._id, setSelectedComponentReference, setPreviewMode]);
|
|
1001
|
-
return (0,
|
|
1051
|
+
return (0, import_react25.useMemo)(
|
|
1002
1052
|
() => ({
|
|
1003
1053
|
isContextualEditing,
|
|
1004
1054
|
selectedComponentReference,
|