@uniformdev/canvas-react 19.61.1 → 19.62.1-alpha.127
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/LICENSE.txt +1 -1
- package/dist/PureUniformText-B3GAm6Dc.d.mts +41 -0
- package/dist/PureUniformText-B3GAm6Dc.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 +89 -22
- package/dist/index.d.ts +89 -22
- package/dist/index.esm.js +136 -85
- package/dist/index.js +183 -134
- package/dist/index.mjs +136 -85
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use strict";
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
@@ -45,7 +46,7 @@ __export(src_exports, {
|
|
|
45
46
|
convertComponentToProps: () => convertComponentToProps,
|
|
46
47
|
createComponentStore: () => createComponentStore,
|
|
47
48
|
createComponentStoreResolver: () => createComponentStoreResolver,
|
|
48
|
-
createUniformApiEnhancer: () =>
|
|
49
|
+
createUniformApiEnhancer: () => import_canvas4.createUniformApiEnhancer,
|
|
49
50
|
getParameterAttributes: () => getParameterAttributes,
|
|
50
51
|
registerUniformComponent: () => registerUniformComponent,
|
|
51
52
|
useCompositionEventEffect: () => useCompositionEventEffect,
|
|
@@ -77,6 +78,9 @@ function DefaultNotImplementedComponent(props) {
|
|
|
77
78
|
if (!componentType) {
|
|
78
79
|
return null;
|
|
79
80
|
}
|
|
81
|
+
if (componentType === import_canvas.EMPTY_COMPOSITION.type) {
|
|
82
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("style", null, `@keyframes _uniformDelayedFadeIn { 0%,75% { opacity: 0; } to { opacity: 1; } }`), /* @__PURE__ */ import_react.default.createElement("p", { style: { animation: "_uniformDelayedFadeIn 3s" } }, "This component only works inside Uniform Canvas editor.", /* @__PURE__ */ import_react.default.createElement("br", null), "If you think this is an error, try", " ", /* @__PURE__ */ import_react.default.createElement("a", { href: "", style: { fontWeight: "bolder", textDecoration: "underline" } }, "reloading the page"), "."));
|
|
83
|
+
}
|
|
80
84
|
if (componentType === import_canvas.CANVAS_LOCALIZATION_TYPE) {
|
|
81
85
|
return /* @__PURE__ */ import_react.default.createElement("div", { style: wrapperStyles }, /* @__PURE__ */ import_react.default.createElement("p", null, "Seems like localization is not enabled in your application. Please read our documentation on how to", " ", /* @__PURE__ */ import_react.default.createElement(
|
|
82
86
|
"a",
|
|
@@ -127,9 +131,9 @@ registerUniformComponent({ type: "${componentType}", component: ${proposedFileNa
|
|
|
127
131
|
}
|
|
128
132
|
|
|
129
133
|
// src/components/UniformComponent.tsx
|
|
130
|
-
var
|
|
134
|
+
var import_canvas7 = require("@uniformdev/canvas");
|
|
131
135
|
var import_context_react2 = require("@uniformdev/context-react");
|
|
132
|
-
var
|
|
136
|
+
var import_react7 = __toESM(require("react"));
|
|
133
137
|
|
|
134
138
|
// src/helpers/convertComponentToProps.ts
|
|
135
139
|
function convertComponentToProps(component) {
|
|
@@ -158,7 +162,8 @@ var createComponentStore = () => {
|
|
|
158
162
|
},
|
|
159
163
|
get: (type, variantId) => {
|
|
160
164
|
return components.get(getTypeWithVariant(type, variantId));
|
|
161
|
-
}
|
|
165
|
+
},
|
|
166
|
+
getComponentsMap: () => new Map(components)
|
|
162
167
|
};
|
|
163
168
|
};
|
|
164
169
|
var createComponentStoreResolver = ({ store, defaultComponent = DefaultNotImplementedComponent }) => {
|
|
@@ -187,8 +192,8 @@ var componentStoreResolver = createComponentStoreResolver({
|
|
|
187
192
|
});
|
|
188
193
|
|
|
189
194
|
// src/components/UniformSlot.tsx
|
|
190
|
-
var
|
|
191
|
-
var
|
|
195
|
+
var import_canvas6 = require("@uniformdev/canvas");
|
|
196
|
+
var import_react6 = __toESM(require("react"));
|
|
192
197
|
|
|
193
198
|
// src/defaultSystemComponentResolver.tsx
|
|
194
199
|
var import_canvas2 = require("@uniformdev/canvas");
|
|
@@ -229,34 +234,67 @@ var defaultSystemComponentResolver = {
|
|
|
229
234
|
};
|
|
230
235
|
|
|
231
236
|
// src/components/ContextualEditingComponentWrapper.tsx
|
|
232
|
-
var
|
|
233
|
-
var
|
|
237
|
+
var import_canvas5 = require("@uniformdev/canvas");
|
|
238
|
+
var import_react5 = __toESM(require("react"));
|
|
239
|
+
|
|
240
|
+
// src/components/PureContextualEditingComponentWrapper.tsx
|
|
241
|
+
var import_canvas3 = require("@uniformdev/canvas");
|
|
242
|
+
var import_react2 = __toESM(require("react"));
|
|
243
|
+
var PureContextualEditingComponentWrapper = ({
|
|
244
|
+
children,
|
|
245
|
+
isPlaceholder,
|
|
246
|
+
parentComponent,
|
|
247
|
+
component,
|
|
248
|
+
slotName,
|
|
249
|
+
indexInSlot,
|
|
250
|
+
slotChildrenCount,
|
|
251
|
+
isReadOnly
|
|
252
|
+
}) => {
|
|
253
|
+
var _a, _b, _c, _d;
|
|
254
|
+
return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement(
|
|
255
|
+
"script",
|
|
256
|
+
{
|
|
257
|
+
"data-role": import_canvas3.IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
|
|
258
|
+
"data-parent-id": parentComponent == null ? void 0 : parentComponent._id,
|
|
259
|
+
"data-parent-type": parentComponent == null ? void 0 : parentComponent.type,
|
|
260
|
+
"data-component-id": component == null ? void 0 : component._id,
|
|
261
|
+
"data-slot-name": slotName != null ? slotName : "",
|
|
262
|
+
"data-component-index": indexInSlot != null ? indexInSlot : "",
|
|
263
|
+
"data-total-components": slotChildrenCount != null ? slotChildrenCount : "",
|
|
264
|
+
"data-component-name": component == null ? void 0 : component.type,
|
|
265
|
+
"data-is-placeholder": isPlaceholder ? "true" : void 0,
|
|
266
|
+
"data-is-localized": ((_a = component == null ? void 0 : component.parameters) == null ? void 0 : _a[import_canvas3.CANVAS_LOCALE_TAG_PARAM]) ? "true" : void 0,
|
|
267
|
+
"data-component-title": (_d = (_c = (_b = component == null ? void 0 : component.parameters) == null ? void 0 : _b.title) == null ? void 0 : _c.value) != null ? _d : "",
|
|
268
|
+
"data-is-readonly": isReadOnly
|
|
269
|
+
}
|
|
270
|
+
), children, /* @__PURE__ */ import_react2.default.createElement("script", { "data-role": import_canvas3.IN_CONTEXT_EDITOR_COMPONENT_END_ROLE }));
|
|
271
|
+
};
|
|
234
272
|
|
|
235
273
|
// src/components/UniformComposition.tsx
|
|
236
|
-
var
|
|
274
|
+
var import_react4 = __toESM(require("react"));
|
|
237
275
|
|
|
238
276
|
// src/hooks/useUniformContextualEditing.ts
|
|
239
|
-
var
|
|
240
|
-
var
|
|
277
|
+
var import_canvas4 = require("@uniformdev/canvas");
|
|
278
|
+
var import_react3 = require("react");
|
|
241
279
|
var registeredCompositionIds = /* @__PURE__ */ new Set();
|
|
242
280
|
var useUniformContextualEditing = ({
|
|
243
281
|
initialCompositionValue,
|
|
244
282
|
enhance = (message) => message.composition
|
|
245
283
|
}) => {
|
|
246
|
-
const [contextualComposition, setContextualComposition] = (0,
|
|
247
|
-
const channel = (0,
|
|
284
|
+
const [contextualComposition, setContextualComposition] = (0, import_react3.useState)();
|
|
285
|
+
const channel = (0, import_react3.useMemo)(() => {
|
|
248
286
|
var _a;
|
|
249
287
|
if (!isInContextEditingMode()) {
|
|
250
288
|
return;
|
|
251
289
|
}
|
|
252
|
-
const channel2 = (0,
|
|
290
|
+
const channel2 = (0, import_canvas4.createCanvasChannel)({
|
|
253
291
|
broadcastTo: [(_a = window.opener) != null ? _a : window.top],
|
|
254
292
|
listenTo: [window]
|
|
255
293
|
});
|
|
256
294
|
return channel2;
|
|
257
295
|
}, []);
|
|
258
|
-
(0,
|
|
259
|
-
if ((contextualComposition == null ? void 0 : contextualComposition._id) && (initialCompositionValue == null ? void 0 : initialCompositionValue._id) !==
|
|
296
|
+
(0, import_react3.useEffect)(() => {
|
|
297
|
+
if ((contextualComposition == null ? void 0 : contextualComposition._id) && (initialCompositionValue == null ? void 0 : initialCompositionValue._id) !== import_canvas4.EMPTY_COMPOSITION._id && (initialCompositionValue == null ? void 0 : initialCompositionValue._id) !== (contextualComposition == null ? void 0 : contextualComposition._id)) {
|
|
260
298
|
setContextualComposition(void 0);
|
|
261
299
|
return;
|
|
262
300
|
}
|
|
@@ -264,7 +302,7 @@ var useUniformContextualEditing = ({
|
|
|
264
302
|
return;
|
|
265
303
|
}
|
|
266
304
|
const unsubscribeFromCompositionUpdates = channel.on("update-composition-internal", async (message) => {
|
|
267
|
-
if (!(0,
|
|
305
|
+
if (!(0, import_canvas4.isUpdateCompositionInternalMessage)(message)) {
|
|
268
306
|
return;
|
|
269
307
|
}
|
|
270
308
|
const enhancedComposition = await enhance(message);
|
|
@@ -276,11 +314,11 @@ var useUniformContextualEditing = ({
|
|
|
276
314
|
registeredCompositionIds.delete(initialCompositionValue == null ? void 0 : initialCompositionValue._id);
|
|
277
315
|
};
|
|
278
316
|
}, [channel, enhance, initialCompositionValue == null ? void 0 : initialCompositionValue._id, contextualComposition == null ? void 0 : contextualComposition._id]);
|
|
279
|
-
(0,
|
|
317
|
+
(0, import_react3.useEffect)(() => {
|
|
280
318
|
if (!isInContextEditingMode()) {
|
|
281
319
|
return;
|
|
282
320
|
}
|
|
283
|
-
const existingScript = document.getElementById(
|
|
321
|
+
const existingScript = document.getElementById(import_canvas4.IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID);
|
|
284
322
|
if (existingScript) {
|
|
285
323
|
return;
|
|
286
324
|
}
|
|
@@ -290,13 +328,13 @@ var useUniformContextualEditing = ({
|
|
|
290
328
|
version: 2
|
|
291
329
|
};
|
|
292
330
|
const script = document.createElement("script");
|
|
293
|
-
script.id =
|
|
331
|
+
script.id = import_canvas4.IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID;
|
|
294
332
|
script.src = getCanvasInContextEmbedScriptUrl();
|
|
295
333
|
script.async = true;
|
|
296
334
|
document.head.appendChild(script);
|
|
297
335
|
}, [initialCompositionValue == null ? void 0 : initialCompositionValue._id]);
|
|
298
336
|
return {
|
|
299
|
-
composition: contextualComposition
|
|
337
|
+
composition: contextualComposition ? contextualComposition : initialCompositionValue,
|
|
300
338
|
isContextualEditing: Boolean(contextualComposition)
|
|
301
339
|
};
|
|
302
340
|
};
|
|
@@ -309,18 +347,18 @@ function isInContextEditingMode() {
|
|
|
309
347
|
return false;
|
|
310
348
|
}
|
|
311
349
|
const isOpenedByInContextEditor = new URLSearchParams(window.location.search).has(
|
|
312
|
-
|
|
350
|
+
import_canvas4.IN_CONTEXT_EDITOR_QUERY_STRING_PARAM
|
|
313
351
|
);
|
|
314
|
-
return isOpenedByInContextEditor && (0,
|
|
352
|
+
return isOpenedByInContextEditor && (0, import_canvas4.isAllowedReferrer)(window.document.referrer);
|
|
315
353
|
}
|
|
316
354
|
|
|
317
355
|
// src/components/UniformComposition.tsx
|
|
318
|
-
var UniformCompositionContext = (0,
|
|
356
|
+
var UniformCompositionContext = (0, import_react4.createContext)({
|
|
319
357
|
data: void 0,
|
|
320
358
|
isContextualEditing: false
|
|
321
359
|
});
|
|
322
360
|
function useUniformCurrentComposition() {
|
|
323
|
-
return (0,
|
|
361
|
+
return (0, import_react4.useContext)(UniformCompositionContext);
|
|
324
362
|
}
|
|
325
363
|
function UniformComposition({
|
|
326
364
|
data,
|
|
@@ -334,12 +372,12 @@ function UniformComposition({
|
|
|
334
372
|
initialCompositionValue: data,
|
|
335
373
|
enhance: contextualEditingEnhancer
|
|
336
374
|
});
|
|
337
|
-
return /* @__PURE__ */
|
|
375
|
+
return /* @__PURE__ */ import_react4.default.createElement(
|
|
338
376
|
UniformCompositionContext.Provider,
|
|
339
377
|
{
|
|
340
378
|
value: { data: composition, behaviorTracking, resolveRenderer, isContextualEditing }
|
|
341
379
|
},
|
|
342
|
-
/* @__PURE__ */
|
|
380
|
+
/* @__PURE__ */ import_react4.default.createElement(ContextualEditingComponentWrapper, { component: composition }, /* @__PURE__ */ import_react4.default.createElement(
|
|
343
381
|
UniformComponent,
|
|
344
382
|
{
|
|
345
383
|
data: composition,
|
|
@@ -362,27 +400,29 @@ function ContextualEditingComponentWrapper({
|
|
|
362
400
|
emptyPlaceholder,
|
|
363
401
|
children
|
|
364
402
|
}) {
|
|
365
|
-
var _a
|
|
366
|
-
const isPlaceholder = (0,
|
|
403
|
+
var _a;
|
|
404
|
+
const isPlaceholder = (0, import_canvas5.isComponentPlaceholderId)(component == null ? void 0 : component._id);
|
|
367
405
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
368
406
|
const isReadOnly = ((_a = component == null ? void 0 : component._contextualEditing) == null ? void 0 : _a.isEditable) ? void 0 : "true";
|
|
369
|
-
|
|
370
|
-
|
|
407
|
+
if (!isContextualEditing) {
|
|
408
|
+
return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, children);
|
|
409
|
+
}
|
|
410
|
+
if (isPlaceholder && emptyPlaceholder === null) {
|
|
411
|
+
return null;
|
|
412
|
+
}
|
|
413
|
+
return /* @__PURE__ */ import_react5.default.createElement(
|
|
414
|
+
PureContextualEditingComponentWrapper,
|
|
371
415
|
{
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
"data-component-title": (_e = (_d = (_c = component == null ? void 0 : component.parameters) == null ? void 0 : _c.title) == null ? void 0 : _d.value) != null ? _e : "",
|
|
383
|
-
"data-is-readonly": isReadOnly
|
|
384
|
-
}
|
|
385
|
-
), isPlaceholder && emptyPlaceholder !== void 0 ? emptyPlaceholder : children, /* @__PURE__ */ import_react4.default.createElement("script", { "data-role": import_canvas4.IN_CONTEXT_EDITOR_COMPONENT_END_ROLE }));
|
|
416
|
+
isPlaceholder,
|
|
417
|
+
parentComponent,
|
|
418
|
+
component,
|
|
419
|
+
slotName,
|
|
420
|
+
indexInSlot,
|
|
421
|
+
slotChildrenCount,
|
|
422
|
+
isReadOnly
|
|
423
|
+
},
|
|
424
|
+
isPlaceholder && emptyPlaceholder !== void 0 ? emptyPlaceholder : children
|
|
425
|
+
);
|
|
386
426
|
}
|
|
387
427
|
|
|
388
428
|
// src/components/UniformSlot.tsx
|
|
@@ -400,7 +440,7 @@ function UniformSlot({
|
|
|
400
440
|
}
|
|
401
441
|
const slot = (_a = parentData.slots) == null ? void 0 : _a[name];
|
|
402
442
|
if (!slot || !Array.isArray(slot)) {
|
|
403
|
-
if (process.env.NODE_ENV === "development" && parentData.type !==
|
|
443
|
+
if (process.env.NODE_ENV === "development" && parentData.type !== import_canvas6.EMPTY_COMPOSITION.type) {
|
|
404
444
|
console.warn(
|
|
405
445
|
`[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:`,
|
|
406
446
|
parentData
|
|
@@ -421,13 +461,13 @@ function UniformSlot({
|
|
|
421
461
|
emptyPlaceholder
|
|
422
462
|
});
|
|
423
463
|
const elements = children ? children({ child, component, key: `wrapped-inner-${index}` }) : child;
|
|
424
|
-
return
|
|
464
|
+
return import_react6.default.createElement(import_react6.default.Fragment, { key: index }, elements);
|
|
425
465
|
});
|
|
426
466
|
if (!wrapperComponent) {
|
|
427
|
-
return
|
|
467
|
+
return import_react6.default.createElement(import_react6.default.Fragment, void 0, finalChildren);
|
|
428
468
|
}
|
|
429
469
|
const Wrapper = wrapperComponent;
|
|
430
|
-
return /* @__PURE__ */
|
|
470
|
+
return /* @__PURE__ */ import_react6.default.createElement(Wrapper, { items: finalChildren, slotName: name });
|
|
431
471
|
}
|
|
432
472
|
function renderComponent({
|
|
433
473
|
component,
|
|
@@ -440,7 +480,7 @@ function renderComponent({
|
|
|
440
480
|
emptyPlaceholder
|
|
441
481
|
}) {
|
|
442
482
|
const RenderComponent = resolveRenderer == null ? void 0 : resolveRenderer(component);
|
|
443
|
-
if (component.type ===
|
|
483
|
+
if (component.type === import_canvas6.CANVAS_TEST_TYPE) {
|
|
444
484
|
const testComponent = defaultSystemComponentResolver.test(
|
|
445
485
|
component,
|
|
446
486
|
key,
|
|
@@ -451,15 +491,15 @@ function renderComponent({
|
|
|
451
491
|
resolveRenderer,
|
|
452
492
|
key: key2,
|
|
453
493
|
parentComponent: component,
|
|
454
|
-
slotName:
|
|
455
|
-
slotChildrenCount: (_a = component == null ? void 0 : component.slots) == null ? void 0 : _a[
|
|
456
|
-
indexInSlot: (_b = component == null ? void 0 : component.slots) == null ? void 0 : _b[
|
|
494
|
+
slotName: import_canvas6.CANVAS_TEST_SLOT,
|
|
495
|
+
slotChildrenCount: (_a = component == null ? void 0 : component.slots) == null ? void 0 : _a[import_canvas6.CANVAS_TEST_SLOT].length,
|
|
496
|
+
indexInSlot: (_b = component == null ? void 0 : component.slots) == null ? void 0 : _b[import_canvas6.CANVAS_TEST_SLOT].findIndex(
|
|
457
497
|
({ _id }) => variantComponent._id === _id
|
|
458
498
|
)
|
|
459
499
|
});
|
|
460
500
|
}
|
|
461
501
|
);
|
|
462
|
-
return /* @__PURE__ */
|
|
502
|
+
return /* @__PURE__ */ import_react6.default.createElement(
|
|
463
503
|
ContextualEditingComponentWrapper,
|
|
464
504
|
{
|
|
465
505
|
component,
|
|
@@ -471,7 +511,7 @@ function renderComponent({
|
|
|
471
511
|
},
|
|
472
512
|
testComponent
|
|
473
513
|
);
|
|
474
|
-
} else if (component.type ===
|
|
514
|
+
} else if (component.type === import_canvas6.CANVAS_PERSONALIZE_TYPE) {
|
|
475
515
|
const personalizationComponent = defaultSystemComponentResolver.personalization(
|
|
476
516
|
component,
|
|
477
517
|
key,
|
|
@@ -482,15 +522,15 @@ function renderComponent({
|
|
|
482
522
|
resolveRenderer,
|
|
483
523
|
key: key2,
|
|
484
524
|
parentComponent: component,
|
|
485
|
-
slotName:
|
|
486
|
-
slotChildrenCount: (_a = component == null ? void 0 : component.slots) == null ? void 0 : _a[
|
|
487
|
-
indexInSlot: (_b = component == null ? void 0 : component.slots) == null ? void 0 : _b[
|
|
525
|
+
slotName: import_canvas6.CANVAS_PERSONALIZE_SLOT,
|
|
526
|
+
slotChildrenCount: (_a = component == null ? void 0 : component.slots) == null ? void 0 : _a[import_canvas6.CANVAS_PERSONALIZE_SLOT].length,
|
|
527
|
+
indexInSlot: (_b = component == null ? void 0 : component.slots) == null ? void 0 : _b[import_canvas6.CANVAS_PERSONALIZE_SLOT].findIndex(
|
|
488
528
|
({ _id }) => variantComponent._id === _id
|
|
489
529
|
)
|
|
490
530
|
});
|
|
491
531
|
}
|
|
492
532
|
);
|
|
493
|
-
return /* @__PURE__ */
|
|
533
|
+
return /* @__PURE__ */ import_react6.default.createElement(
|
|
494
534
|
ContextualEditingComponentWrapper,
|
|
495
535
|
{
|
|
496
536
|
component,
|
|
@@ -504,7 +544,7 @@ function renderComponent({
|
|
|
504
544
|
);
|
|
505
545
|
} else if (RenderComponent) {
|
|
506
546
|
const props = convertComponentToProps(component);
|
|
507
|
-
return /* @__PURE__ */
|
|
547
|
+
return /* @__PURE__ */ import_react6.default.createElement(UniformComponent, { key, data: component, resolveRenderer }, /* @__PURE__ */ import_react6.default.createElement(
|
|
508
548
|
ContextualEditingComponentWrapper,
|
|
509
549
|
{
|
|
510
550
|
component,
|
|
@@ -514,7 +554,7 @@ function renderComponent({
|
|
|
514
554
|
slotChildrenCount,
|
|
515
555
|
emptyPlaceholder
|
|
516
556
|
},
|
|
517
|
-
/* @__PURE__ */
|
|
557
|
+
/* @__PURE__ */ import_react6.default.createElement(RenderComponent, { ...props })
|
|
518
558
|
));
|
|
519
559
|
} else if (process.env.NODE_ENV !== "production") {
|
|
520
560
|
console.warn(
|
|
@@ -527,9 +567,9 @@ function renderComponent({
|
|
|
527
567
|
}
|
|
528
568
|
|
|
529
569
|
// src/components/UniformComponent.tsx
|
|
530
|
-
var UniformComponentContext = (0,
|
|
570
|
+
var UniformComponentContext = (0, import_react7.createContext)({});
|
|
531
571
|
function useUniformCurrentComponent() {
|
|
532
|
-
return (0,
|
|
572
|
+
return (0, import_react7.useContext)(UniformComponentContext);
|
|
533
573
|
}
|
|
534
574
|
function UniformComponent({
|
|
535
575
|
data,
|
|
@@ -553,7 +593,7 @@ function UniformComponent({
|
|
|
553
593
|
behaviorTracking: (_a = behaviorTracking != null ? behaviorTracking : parentData == null ? void 0 : parentData.behaviorTracking) != null ? _a : "onView",
|
|
554
594
|
contextualEditingDefaultPlaceholder: contextualEditingDefaultPlaceholder != null ? contextualEditingDefaultPlaceholder : parentData.contextualEditingDefaultPlaceholder
|
|
555
595
|
};
|
|
556
|
-
const enrichmentTags = (_c = (_b = data.parameters) == null ? void 0 : _b[
|
|
596
|
+
const enrichmentTags = (_c = (_b = data.parameters) == null ? void 0 : _b[import_canvas7.CANVAS_ENRICHMENT_TAG_PARAM]) == null ? void 0 : _c.value;
|
|
557
597
|
const TrackComponent = contextValue.behaviorTracking === "onLoad" ? import_context_react2.TrackFragment : import_context_react2.Track;
|
|
558
598
|
const resolvedChildren = resolveChildren({
|
|
559
599
|
children,
|
|
@@ -561,9 +601,9 @@ function UniformComponent({
|
|
|
561
601
|
hasParentLayout: Boolean(parentData.data),
|
|
562
602
|
resolveRenderer: contextValue.resolveRenderer
|
|
563
603
|
});
|
|
564
|
-
return /* @__PURE__ */
|
|
604
|
+
return /* @__PURE__ */ import_react7.default.createElement(UniformComponentContext.Provider, { value: contextValue }, contextContextProviderPresent ? (
|
|
565
605
|
/* auto-track behavior signals when in a Canvas context */
|
|
566
|
-
/* @__PURE__ */
|
|
606
|
+
/* @__PURE__ */ import_react7.default.createElement(TrackComponent, { behavior: enrichmentTags }, resolvedChildren)
|
|
567
607
|
) : resolvedChildren);
|
|
568
608
|
}
|
|
569
609
|
function resolveChildren({
|
|
@@ -576,14 +616,14 @@ function resolveChildren({
|
|
|
576
616
|
if (!children && !hasParentLayout) {
|
|
577
617
|
const topLevelComponent = resolveRenderer({ type: data.type });
|
|
578
618
|
if (topLevelComponent) {
|
|
579
|
-
children =
|
|
619
|
+
children = import_react7.default.createElement(topLevelComponent, convertComponentToProps(data));
|
|
580
620
|
} else {
|
|
581
621
|
if (Object.keys((_a = data.slots) != null ? _a : {}).length > 1 && process.env.NODE_ENV === "development") {
|
|
582
622
|
console.warn(
|
|
583
623
|
`[canvas-dev] All the slots in component '${data.type}' are rendered in no particular order. Use '<UniformSlot name={slotName} />' to reliably render the slots.`
|
|
584
624
|
);
|
|
585
625
|
}
|
|
586
|
-
children = Object.keys(data.slots || {}).map((slotName) => /* @__PURE__ */
|
|
626
|
+
children = Object.keys(data.slots || {}).map((slotName) => /* @__PURE__ */ import_react7.default.createElement(UniformSlot, { key: slotName, name: slotName }));
|
|
587
627
|
}
|
|
588
628
|
}
|
|
589
629
|
const renderChildren = typeof children === "function" ? children(convertComponentToProps(data)) : children;
|
|
@@ -591,8 +631,8 @@ function resolveChildren({
|
|
|
591
631
|
}
|
|
592
632
|
|
|
593
633
|
// src/components/UniformPlayground.tsx
|
|
594
|
-
var
|
|
595
|
-
var
|
|
634
|
+
var import_canvas8 = require("@uniformdev/canvas");
|
|
635
|
+
var import_react8 = __toESM(require("react"));
|
|
596
636
|
var UniformPlayground = ({
|
|
597
637
|
resolveRenderer,
|
|
598
638
|
decorators = [],
|
|
@@ -602,14 +642,14 @@ var UniformPlayground = ({
|
|
|
602
642
|
children
|
|
603
643
|
}) => {
|
|
604
644
|
const { composition, isContextualEditing } = useUniformContextualEditing({
|
|
605
|
-
initialCompositionValue:
|
|
645
|
+
initialCompositionValue: import_canvas8.EMPTY_COMPOSITION,
|
|
606
646
|
enhance: contextualEditingEnhancer
|
|
607
647
|
});
|
|
608
|
-
const renderedComponent = (0,
|
|
648
|
+
const renderedComponent = (0, import_react8.useMemo)(() => {
|
|
609
649
|
if (!composition) {
|
|
610
650
|
return null;
|
|
611
651
|
}
|
|
612
|
-
let component = /* @__PURE__ */
|
|
652
|
+
let component = /* @__PURE__ */ import_react8.default.createElement(ContextualEditingComponentWrapper, { component: composition }, /* @__PURE__ */ import_react8.default.createElement(
|
|
613
653
|
UniformComponent,
|
|
614
654
|
{
|
|
615
655
|
data: composition,
|
|
@@ -620,7 +660,7 @@ var UniformPlayground = ({
|
|
|
620
660
|
children
|
|
621
661
|
));
|
|
622
662
|
decorators.forEach((Decorator) => {
|
|
623
|
-
component = /* @__PURE__ */
|
|
663
|
+
component = /* @__PURE__ */ import_react8.default.createElement(Decorator, { data: composition }, component);
|
|
624
664
|
});
|
|
625
665
|
return component;
|
|
626
666
|
}, [
|
|
@@ -631,7 +671,7 @@ var UniformPlayground = ({
|
|
|
631
671
|
behaviorTracking,
|
|
632
672
|
contextualEditingDefaultPlaceholder
|
|
633
673
|
]);
|
|
634
|
-
return /* @__PURE__ */
|
|
674
|
+
return /* @__PURE__ */ import_react8.default.createElement(
|
|
635
675
|
UniformCompositionContext.Provider,
|
|
636
676
|
{
|
|
637
677
|
value: { data: composition, behaviorTracking, resolveRenderer, isContextualEditing }
|
|
@@ -641,57 +681,57 @@ var UniformPlayground = ({
|
|
|
641
681
|
};
|
|
642
682
|
|
|
643
683
|
// src/components/UniformRichText/UniformRichText.tsx
|
|
644
|
-
var
|
|
684
|
+
var import_canvas9 = require("@uniformdev/canvas");
|
|
645
685
|
var import_richtext5 = require("@uniformdev/richtext");
|
|
646
|
-
var
|
|
686
|
+
var import_react18 = __toESM(require("react"));
|
|
647
687
|
|
|
648
688
|
// src/components/UniformRichText/UniformRichTextNode.tsx
|
|
649
689
|
var import_richtext4 = require("@uniformdev/richtext");
|
|
650
|
-
var
|
|
690
|
+
var import_react17 = __toESM(require("react"));
|
|
651
691
|
|
|
652
692
|
// src/components/UniformRichText/nodes/HeadingRichTextNode.tsx
|
|
653
|
-
var
|
|
693
|
+
var import_react9 = __toESM(require("react"));
|
|
654
694
|
var HeadingRichTextNode = ({ children, node }) => {
|
|
655
695
|
const { tag } = node;
|
|
656
696
|
const HTag = tag != null ? tag : "h1";
|
|
657
|
-
return /* @__PURE__ */
|
|
697
|
+
return /* @__PURE__ */ import_react9.default.createElement(HTag, null, children);
|
|
658
698
|
};
|
|
659
699
|
|
|
660
700
|
// src/components/UniformRichText/nodes/LinebreakRichTextNode.tsx
|
|
661
|
-
var
|
|
701
|
+
var import_react10 = __toESM(require("react"));
|
|
662
702
|
var LinebreakRichTextNode = () => {
|
|
663
|
-
return /* @__PURE__ */
|
|
703
|
+
return /* @__PURE__ */ import_react10.default.createElement("br", null);
|
|
664
704
|
};
|
|
665
705
|
|
|
666
706
|
// src/components/UniformRichText/nodes/LinkRichTextNode.tsx
|
|
667
707
|
var import_richtext = require("@uniformdev/richtext");
|
|
668
|
-
var
|
|
708
|
+
var import_react11 = __toESM(require("react"));
|
|
669
709
|
var LinkRichTextNode = ({ children, node }) => {
|
|
670
710
|
const { link } = node;
|
|
671
|
-
return /* @__PURE__ */
|
|
711
|
+
return /* @__PURE__ */ import_react11.default.createElement("a", { href: (0, import_richtext.linkParamValueToHref)(link) }, children);
|
|
672
712
|
};
|
|
673
713
|
|
|
674
714
|
// src/components/UniformRichText/nodes/ListItemRichTextNode.tsx
|
|
675
|
-
var
|
|
715
|
+
var import_react12 = __toESM(require("react"));
|
|
676
716
|
var ListItemRichTextNode = ({ children, node }) => {
|
|
677
717
|
const { value } = node;
|
|
678
|
-
return /* @__PURE__ */
|
|
718
|
+
return /* @__PURE__ */ import_react12.default.createElement("li", { value: Number.isFinite(value) && value > 0 ? value : void 0 }, children);
|
|
679
719
|
};
|
|
680
720
|
|
|
681
721
|
// src/components/UniformRichText/nodes/ListRichTextNode.tsx
|
|
682
|
-
var
|
|
722
|
+
var import_react13 = __toESM(require("react"));
|
|
683
723
|
var ListRichTextNode = ({ children, node }) => {
|
|
684
724
|
const { tag, start } = node;
|
|
685
725
|
const ListTag = tag != null ? tag : "ul";
|
|
686
|
-
return /* @__PURE__ */
|
|
726
|
+
return /* @__PURE__ */ import_react13.default.createElement(ListTag, { start: Number.isFinite(start) && start > 0 ? start : void 0 }, children);
|
|
687
727
|
};
|
|
688
728
|
|
|
689
729
|
// src/components/UniformRichText/nodes/ParagraphRichTextNode.tsx
|
|
690
730
|
var import_richtext2 = require("@uniformdev/richtext");
|
|
691
|
-
var
|
|
731
|
+
var import_react14 = __toESM(require("react"));
|
|
692
732
|
var ParagraphRichTextNode = ({ children, node }) => {
|
|
693
733
|
const { format, direction } = node;
|
|
694
|
-
return /* @__PURE__ */
|
|
734
|
+
return /* @__PURE__ */ import_react14.default.createElement(
|
|
695
735
|
"p",
|
|
696
736
|
{
|
|
697
737
|
dir: (0, import_richtext2.isPureDirection)(direction) ? direction : void 0,
|
|
@@ -702,18 +742,18 @@ var ParagraphRichTextNode = ({ children, node }) => {
|
|
|
702
742
|
};
|
|
703
743
|
|
|
704
744
|
// src/components/UniformRichText/nodes/TabRichTextNode.tsx
|
|
705
|
-
var
|
|
745
|
+
var import_react15 = __toESM(require("react"));
|
|
706
746
|
var TabRichTextNode = () => {
|
|
707
|
-
return /* @__PURE__ */
|
|
747
|
+
return /* @__PURE__ */ import_react15.default.createElement(import_react15.default.Fragment, null, " ");
|
|
708
748
|
};
|
|
709
749
|
|
|
710
750
|
// src/components/UniformRichText/nodes/TextRichTextNode.tsx
|
|
711
751
|
var import_richtext3 = require("@uniformdev/richtext");
|
|
712
|
-
var
|
|
752
|
+
var import_react16 = __toESM(require("react"));
|
|
713
753
|
var TextRichTextNode = ({ node }) => {
|
|
714
754
|
const { text, format } = node;
|
|
715
755
|
const tags = (0, import_richtext3.getRichTextTagsFromTextFormat)(format);
|
|
716
|
-
return /* @__PURE__ */
|
|
756
|
+
return /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, tags.length > 0 ? tags.reduceRight((children, Tag) => /* @__PURE__ */ import_react16.default.createElement(Tag, null, children), text) : text);
|
|
717
757
|
};
|
|
718
758
|
|
|
719
759
|
// src/components/UniformRichText/UniformRichTextNode.tsx
|
|
@@ -728,8 +768,8 @@ function UniformRichTextNode({ node, ...props }) {
|
|
|
728
768
|
if (!NodeRenderer) {
|
|
729
769
|
return null;
|
|
730
770
|
}
|
|
731
|
-
const children = node.children ? node.children.map((childNode, i) => /* @__PURE__ */
|
|
732
|
-
return /* @__PURE__ */
|
|
771
|
+
const children = node.children ? node.children.map((childNode, i) => /* @__PURE__ */ import_react17.default.createElement(UniformRichTextNode, { ...props, key: i, node: childNode })) : null;
|
|
772
|
+
return /* @__PURE__ */ import_react17.default.createElement(NodeRenderer, { node }, children);
|
|
733
773
|
}
|
|
734
774
|
var rendererMap = /* @__PURE__ */ new Map([
|
|
735
775
|
["heading", HeadingRichTextNode],
|
|
@@ -738,12 +778,12 @@ var rendererMap = /* @__PURE__ */ new Map([
|
|
|
738
778
|
["list", ListRichTextNode],
|
|
739
779
|
["listitem", ListItemRichTextNode],
|
|
740
780
|
["paragraph", ParagraphRichTextNode],
|
|
741
|
-
["quote", ({ children }) => /* @__PURE__ */
|
|
781
|
+
["quote", ({ children }) => /* @__PURE__ */ import_react17.default.createElement("blockquote", null, children)],
|
|
742
782
|
[
|
|
743
783
|
"code",
|
|
744
|
-
({ children }) => /* @__PURE__ */
|
|
784
|
+
({ children }) => /* @__PURE__ */ import_react17.default.createElement("pre", null, /* @__PURE__ */ import_react17.default.createElement("code", null, children))
|
|
745
785
|
],
|
|
746
|
-
["root", ({ children }) => /* @__PURE__ */
|
|
786
|
+
["root", ({ children }) => /* @__PURE__ */ import_react17.default.createElement(import_react17.default.Fragment, null, children)],
|
|
747
787
|
["text", TextRichTextNode],
|
|
748
788
|
["tab", TabRichTextNode]
|
|
749
789
|
]);
|
|
@@ -752,35 +792,35 @@ var resolveRichTextDefaultRenderer = (node) => {
|
|
|
752
792
|
};
|
|
753
793
|
|
|
754
794
|
// src/components/UniformRichText/UniformRichText.tsx
|
|
755
|
-
var UniformRichText =
|
|
795
|
+
var UniformRichText = import_react18.default.forwardRef(function UniformRichText2({ parameterId, resolveRichTextRenderer, as: Tag = "div", ...props }, ref) {
|
|
756
796
|
const { data: componentData } = useUniformCurrentComponent();
|
|
757
|
-
const parameter = (0,
|
|
797
|
+
const parameter = (0, import_react18.useMemo)(() => {
|
|
758
798
|
var _a;
|
|
759
799
|
return (_a = componentData == null ? void 0 : componentData.parameters) == null ? void 0 : _a[parameterId];
|
|
760
800
|
}, [componentData, parameterId]);
|
|
761
|
-
const value = (0,
|
|
801
|
+
const value = (0, import_react18.useMemo)(() => parameter == null ? void 0 : parameter.value, [parameter]);
|
|
762
802
|
if (!value || !(0, import_richtext5.isRichTextValue)(value) || (0, import_richtext5.isRichTextValueConsideredEmpty)(value))
|
|
763
803
|
return null;
|
|
764
|
-
return Tag === null ? /* @__PURE__ */
|
|
804
|
+
return Tag === null ? /* @__PURE__ */ import_react18.default.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer }) : /* @__PURE__ */ import_react18.default.createElement(
|
|
765
805
|
Tag,
|
|
766
806
|
{
|
|
767
807
|
ref,
|
|
768
808
|
...props,
|
|
769
809
|
...{
|
|
770
|
-
[
|
|
771
|
-
[
|
|
772
|
-
[
|
|
810
|
+
[import_canvas9.ATTRIBUTE_COMPONENT_ID]: componentData == null ? void 0 : componentData._id,
|
|
811
|
+
[import_canvas9.ATTRIBUTE_PARAMETER_ID]: parameterId,
|
|
812
|
+
[import_canvas9.ATTRIBUTE_PARAMETER_TYPE]: "richText"
|
|
773
813
|
}
|
|
774
814
|
},
|
|
775
|
-
/* @__PURE__ */
|
|
815
|
+
/* @__PURE__ */ import_react18.default.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer })
|
|
776
816
|
);
|
|
777
817
|
});
|
|
778
818
|
|
|
779
819
|
// src/components/UniformText.tsx
|
|
780
|
-
var
|
|
820
|
+
var import_react20 = __toESM(require("react"));
|
|
781
821
|
|
|
782
822
|
// src/components/PureUniformText.tsx
|
|
783
|
-
var
|
|
823
|
+
var import_react19 = __toESM(require("react"));
|
|
784
824
|
var PureUniformText = ({
|
|
785
825
|
as: Tag = "span",
|
|
786
826
|
parameterId,
|
|
@@ -799,10 +839,10 @@ var PureUniformText = ({
|
|
|
799
839
|
return null;
|
|
800
840
|
}
|
|
801
841
|
if (!isContextualEditing) {
|
|
802
|
-
return /* @__PURE__ */
|
|
842
|
+
return /* @__PURE__ */ import_react19.default.createElement(Tag, { style: isMultiline ? { whiteSpace: "pre-wrap" } : {}, ...props }, render(value));
|
|
803
843
|
}
|
|
804
844
|
const computedPlaceholder = typeof placeholder === "function" ? placeholder({ id: parameterId }) : placeholder;
|
|
805
|
-
return /* @__PURE__ */
|
|
845
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
806
846
|
Tag,
|
|
807
847
|
{
|
|
808
848
|
...props,
|
|
@@ -831,7 +871,7 @@ var UniformText = ({
|
|
|
831
871
|
var _a, _b, _c;
|
|
832
872
|
const { data: componentData, contextualEditingDefaultPlaceholder } = useUniformCurrentComponent();
|
|
833
873
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
834
|
-
const [isFocused, setIsFocused] = (0,
|
|
874
|
+
const [isFocused, setIsFocused] = (0, import_react20.useState)(false);
|
|
835
875
|
const parameter = (_a = componentData == null ? void 0 : componentData.parameters) == null ? void 0 : _a[parameterId];
|
|
836
876
|
const isEditable = (_c = (_b = parameter == null ? void 0 : parameter._contextualEditing) == null ? void 0 : _b.isEditable) != null ? _c : false;
|
|
837
877
|
const shouldSkipCustomRendering = isFocused && isEditable;
|
|
@@ -840,7 +880,7 @@ var UniformText = ({
|
|
|
840
880
|
}
|
|
841
881
|
const placeholderProp = placeholder != null ? placeholder : contextualEditingDefaultPlaceholder;
|
|
842
882
|
const computedPlaceholder = typeof placeholderProp === "function" ? placeholderProp({ id: parameterId }) : placeholderProp;
|
|
843
|
-
return /* @__PURE__ */
|
|
883
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
844
884
|
PureUniformText,
|
|
845
885
|
{
|
|
846
886
|
...props,
|
|
@@ -863,35 +903,35 @@ var UniformText = ({
|
|
|
863
903
|
};
|
|
864
904
|
|
|
865
905
|
// src/helpers/getParameterAttributes.ts
|
|
866
|
-
var
|
|
906
|
+
var import_canvas10 = require("@uniformdev/canvas");
|
|
867
907
|
var getParameterAttributes = (options) => {
|
|
868
908
|
return {
|
|
869
|
-
...(0,
|
|
909
|
+
...(0, import_canvas10.getParameterAttributes)(options),
|
|
870
910
|
suppressContentEditableWarning: true
|
|
871
911
|
};
|
|
872
912
|
};
|
|
873
913
|
|
|
874
914
|
// src/hooks/useCompositionEventEffect.ts
|
|
875
|
-
var
|
|
876
|
-
var
|
|
915
|
+
var import_canvas11 = require("@uniformdev/canvas");
|
|
916
|
+
var import_react21 = require("react");
|
|
877
917
|
function useCompositionEventEffect({
|
|
878
918
|
enabled,
|
|
879
919
|
projectId,
|
|
880
920
|
compositionId,
|
|
881
921
|
effect
|
|
882
922
|
}) {
|
|
883
|
-
(0,
|
|
923
|
+
(0, import_react21.useEffect)(() => {
|
|
884
924
|
if (!enabled || !compositionId || !projectId) {
|
|
885
925
|
return;
|
|
886
926
|
}
|
|
887
927
|
let goodbye = void 0;
|
|
888
928
|
const loadEffect = async () => {
|
|
889
|
-
const eventBus = await (0,
|
|
929
|
+
const eventBus = await (0, import_canvas11.createEventBus)();
|
|
890
930
|
if (eventBus) {
|
|
891
|
-
goodbye = (0,
|
|
931
|
+
goodbye = (0, import_canvas11.subscribeToComposition)({
|
|
892
932
|
eventBus,
|
|
893
933
|
compositionId,
|
|
894
|
-
compositionState:
|
|
934
|
+
compositionState: import_canvas11.CANVAS_DRAFT_STATE,
|
|
895
935
|
projectId,
|
|
896
936
|
callback: effect,
|
|
897
937
|
event: "updated"
|
|
@@ -908,34 +948,42 @@ function useCompositionEventEffect({
|
|
|
908
948
|
}
|
|
909
949
|
|
|
910
950
|
// src/hooks/useUniformContextualEditingState.ts
|
|
911
|
-
var
|
|
912
|
-
var
|
|
951
|
+
var import_canvas12 = require("@uniformdev/canvas");
|
|
952
|
+
var import_react22 = require("react");
|
|
913
953
|
var useUniformContextualEditingState = ({
|
|
914
954
|
global = false
|
|
915
955
|
} = {}) => {
|
|
916
956
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
917
957
|
const { data: componentData } = useUniformCurrentComponent();
|
|
918
|
-
const [selectedComponentReference, setSelectedComponentReference] = (0,
|
|
919
|
-
const
|
|
958
|
+
const [selectedComponentReference, setSelectedComponentReference] = (0, import_react22.useState)();
|
|
959
|
+
const [previewMode, setPreviewMode] = (0, import_react22.useState)(
|
|
960
|
+
isContextualEditing ? "editor" : void 0
|
|
961
|
+
);
|
|
962
|
+
const channel = (0, import_react22.useMemo)(() => {
|
|
920
963
|
if (!isContextualEditing) {
|
|
921
964
|
return;
|
|
922
965
|
}
|
|
923
|
-
const channel2 = (0,
|
|
966
|
+
const channel2 = (0, import_canvas12.createCanvasChannel)({
|
|
924
967
|
broadcastTo: [window],
|
|
925
968
|
listenTo: [window]
|
|
926
969
|
});
|
|
927
970
|
return channel2;
|
|
928
971
|
}, [isContextualEditing]);
|
|
929
|
-
(0,
|
|
972
|
+
(0, import_react22.useEffect)(() => {
|
|
973
|
+
var _a, _b;
|
|
930
974
|
if (!channel) {
|
|
931
975
|
return;
|
|
932
976
|
}
|
|
977
|
+
if (typeof window !== "undefined") {
|
|
978
|
+
setPreviewMode((_b = (_a = window.__UNIFORM_CONTEXTUAL_EDITING__) == null ? void 0 : _a.state) == null ? void 0 : _b.previewMode);
|
|
979
|
+
}
|
|
933
980
|
const unsubscribe = channel.on("update-contextual-editing-state-internal", async (message) => {
|
|
934
|
-
var
|
|
935
|
-
if (!(0,
|
|
981
|
+
var _a2;
|
|
982
|
+
if (!(0, import_canvas12.isUpdateContextualEditingStateInternalMessage)(message)) {
|
|
936
983
|
return;
|
|
937
984
|
}
|
|
938
|
-
|
|
985
|
+
setPreviewMode(message.state.previewMode);
|
|
986
|
+
if (!global && (componentData == null ? void 0 : componentData._id) !== ((_a2 = message.state.selectedComponentReference) == null ? void 0 : _a2.parentId)) {
|
|
939
987
|
setSelectedComponentReference(void 0);
|
|
940
988
|
return;
|
|
941
989
|
}
|
|
@@ -944,13 +992,14 @@ var useUniformContextualEditingState = ({
|
|
|
944
992
|
return () => {
|
|
945
993
|
unsubscribe();
|
|
946
994
|
};
|
|
947
|
-
}, [global, channel, componentData == null ? void 0 : componentData._id, setSelectedComponentReference]);
|
|
948
|
-
return (0,
|
|
995
|
+
}, [global, channel, componentData == null ? void 0 : componentData._id, setSelectedComponentReference, setPreviewMode]);
|
|
996
|
+
return (0, import_react22.useMemo)(
|
|
949
997
|
() => ({
|
|
950
998
|
isContextualEditing,
|
|
951
|
-
selectedComponentReference
|
|
999
|
+
selectedComponentReference,
|
|
1000
|
+
previewMode
|
|
952
1001
|
}),
|
|
953
|
-
[isContextualEditing, selectedComponentReference]
|
|
1002
|
+
[isContextualEditing, selectedComponentReference, previewMode]
|
|
954
1003
|
);
|
|
955
1004
|
};
|
|
956
1005
|
// Annotate the CommonJS export names for ESM import in node:
|