@uniformdev/canvas-react 18.35.1-alpha.27 → 18.38.1-alpha.10
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.ts +253 -2
- package/dist/index.esm.js +12 -2
- package/dist/index.js +17 -2
- package/dist/index.mjs +12 -2
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -69,11 +69,130 @@ type UniformComponentContextValue = {
|
|
|
69
69
|
declare function useUniformCurrentComponent(): UniformComponentContextValue;
|
|
70
70
|
/**
|
|
71
71
|
* Allows the rendering of a Canvas component instance (root or not), and its children if it has any.
|
|
72
|
-
* Note that the actual rendering happens inside `<
|
|
72
|
+
* Note that the actual rendering happens inside `<Slot />`, this component only provides the services needed to achieve that.
|
|
73
73
|
* This component is used internally by `<UniformComposition />`, which you should use in most cases.
|
|
74
74
|
*/
|
|
75
75
|
declare function UniformComponent<TRenderProps = unknown>({ data, resolveRenderer, children, behaviorTracking, }: UniformComponentProps<TRenderProps>): JSX.Element | null;
|
|
76
76
|
|
|
77
|
+
/** @deprecated use `createUniformApiEnhancer` instead */
|
|
78
|
+
declare const createApiEnhancer: ({ apiUrl }: {
|
|
79
|
+
apiUrl: string;
|
|
80
|
+
}) => (message: UpdateCompositionMessage) => Promise<{
|
|
81
|
+
type: string;
|
|
82
|
+
parameters?: {
|
|
83
|
+
[key: string]: {
|
|
84
|
+
value: unknown;
|
|
85
|
+
type: string;
|
|
86
|
+
connectedData?: {
|
|
87
|
+
pointer: string;
|
|
88
|
+
syntax: "jptr";
|
|
89
|
+
} | undefined;
|
|
90
|
+
};
|
|
91
|
+
} | undefined;
|
|
92
|
+
variant?: string | undefined;
|
|
93
|
+
projectMapNodes?: {
|
|
94
|
+
id: string;
|
|
95
|
+
path: string;
|
|
96
|
+
projectMapId: string;
|
|
97
|
+
}[] | undefined;
|
|
98
|
+
slots?: {
|
|
99
|
+
[key: string]: {
|
|
100
|
+
type: string;
|
|
101
|
+
parameters?: {
|
|
102
|
+
[key: string]: {
|
|
103
|
+
value: unknown;
|
|
104
|
+
type: string;
|
|
105
|
+
connectedData?: {
|
|
106
|
+
pointer: string;
|
|
107
|
+
syntax: "jptr";
|
|
108
|
+
} | undefined;
|
|
109
|
+
};
|
|
110
|
+
} | undefined;
|
|
111
|
+
variant?: string | undefined;
|
|
112
|
+
slots?: {
|
|
113
|
+
[key: string]: any[];
|
|
114
|
+
} | undefined;
|
|
115
|
+
_id?: string | undefined;
|
|
116
|
+
_pattern?: string | undefined;
|
|
117
|
+
_dataResources?: {
|
|
118
|
+
[key: string]: {
|
|
119
|
+
type: string;
|
|
120
|
+
isPatternParameter?: boolean | undefined;
|
|
121
|
+
ignorePatternParameterDefault?: boolean | undefined;
|
|
122
|
+
variables?: {
|
|
123
|
+
[key: string]: string;
|
|
124
|
+
} | undefined;
|
|
125
|
+
};
|
|
126
|
+
} | undefined;
|
|
127
|
+
_patternDataResources?: {
|
|
128
|
+
[key: string]: {
|
|
129
|
+
type: string;
|
|
130
|
+
isPatternParameter?: boolean | undefined;
|
|
131
|
+
ignorePatternParameterDefault?: boolean | undefined;
|
|
132
|
+
variables?: {
|
|
133
|
+
[key: string]: string;
|
|
134
|
+
} | undefined;
|
|
135
|
+
};
|
|
136
|
+
} | undefined;
|
|
137
|
+
_patternError?: "NOTFOUND" | "CYCLIC" | undefined;
|
|
138
|
+
_overrides?: {
|
|
139
|
+
[key: string]: {
|
|
140
|
+
parameters?: {
|
|
141
|
+
[key: string]: {
|
|
142
|
+
value: unknown;
|
|
143
|
+
type: string;
|
|
144
|
+
connectedData?: {
|
|
145
|
+
pointer: string;
|
|
146
|
+
syntax: "jptr";
|
|
147
|
+
} | undefined;
|
|
148
|
+
};
|
|
149
|
+
} | undefined;
|
|
150
|
+
variant?: string | undefined;
|
|
151
|
+
};
|
|
152
|
+
} | undefined;
|
|
153
|
+
_overridability?: {
|
|
154
|
+
parameters?: {
|
|
155
|
+
[key: string]: "yes" | "no";
|
|
156
|
+
} | undefined;
|
|
157
|
+
variants?: boolean | undefined;
|
|
158
|
+
} | undefined;
|
|
159
|
+
}[];
|
|
160
|
+
} | undefined;
|
|
161
|
+
_id: string;
|
|
162
|
+
_slug?: string | null | undefined;
|
|
163
|
+
_name: string;
|
|
164
|
+
_dataResources?: {
|
|
165
|
+
[key: string]: {
|
|
166
|
+
type: string;
|
|
167
|
+
isPatternParameter?: boolean | undefined;
|
|
168
|
+
ignorePatternParameterDefault?: boolean | undefined;
|
|
169
|
+
variables?: {
|
|
170
|
+
[key: string]: string;
|
|
171
|
+
} | undefined;
|
|
172
|
+
};
|
|
173
|
+
} | undefined;
|
|
174
|
+
_overrides?: {
|
|
175
|
+
[key: string]: {
|
|
176
|
+
parameters?: {
|
|
177
|
+
[key: string]: {
|
|
178
|
+
value: unknown;
|
|
179
|
+
type: string;
|
|
180
|
+
connectedData?: {
|
|
181
|
+
pointer: string;
|
|
182
|
+
syntax: "jptr";
|
|
183
|
+
} | undefined;
|
|
184
|
+
};
|
|
185
|
+
} | undefined;
|
|
186
|
+
variant?: string | undefined;
|
|
187
|
+
};
|
|
188
|
+
} | undefined;
|
|
189
|
+
_overridability?: {
|
|
190
|
+
parameters?: {
|
|
191
|
+
[key: string]: "yes" | "no";
|
|
192
|
+
} | undefined;
|
|
193
|
+
variants?: boolean | undefined;
|
|
194
|
+
} | undefined;
|
|
195
|
+
}>;
|
|
77
196
|
type UseUniformContextualEditingProps = {
|
|
78
197
|
initialCompositionValue?: RootComponentInstance;
|
|
79
198
|
/**
|
|
@@ -205,6 +324,128 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
|
|
|
205
324
|
} | undefined;
|
|
206
325
|
isContextualEditing: boolean;
|
|
207
326
|
};
|
|
327
|
+
/** @deprecated use useUniformContextualEditing instead */
|
|
328
|
+
declare const useContextualEditing: ({ initialCompositionValue, enhance, }: UseUniformContextualEditingProps) => {
|
|
329
|
+
composition: {
|
|
330
|
+
type: string;
|
|
331
|
+
parameters?: {
|
|
332
|
+
[key: string]: {
|
|
333
|
+
value: unknown;
|
|
334
|
+
type: string;
|
|
335
|
+
connectedData?: {
|
|
336
|
+
pointer: string;
|
|
337
|
+
syntax: "jptr";
|
|
338
|
+
} | undefined;
|
|
339
|
+
};
|
|
340
|
+
} | undefined;
|
|
341
|
+
variant?: string | undefined;
|
|
342
|
+
projectMapNodes?: {
|
|
343
|
+
id: string;
|
|
344
|
+
path: string;
|
|
345
|
+
projectMapId: string;
|
|
346
|
+
}[] | undefined;
|
|
347
|
+
slots?: {
|
|
348
|
+
[key: string]: {
|
|
349
|
+
type: string;
|
|
350
|
+
parameters?: {
|
|
351
|
+
[key: string]: {
|
|
352
|
+
value: unknown;
|
|
353
|
+
type: string;
|
|
354
|
+
connectedData?: {
|
|
355
|
+
pointer: string;
|
|
356
|
+
syntax: "jptr";
|
|
357
|
+
} | undefined;
|
|
358
|
+
};
|
|
359
|
+
} | undefined;
|
|
360
|
+
variant?: string | undefined;
|
|
361
|
+
slots?: {
|
|
362
|
+
[key: string]: any[];
|
|
363
|
+
} | undefined;
|
|
364
|
+
_id?: string | undefined;
|
|
365
|
+
_pattern?: string | undefined;
|
|
366
|
+
_dataResources?: {
|
|
367
|
+
[key: string]: {
|
|
368
|
+
type: string;
|
|
369
|
+
isPatternParameter?: boolean | undefined;
|
|
370
|
+
ignorePatternParameterDefault?: boolean | undefined;
|
|
371
|
+
variables?: {
|
|
372
|
+
[key: string]: string;
|
|
373
|
+
} | undefined;
|
|
374
|
+
};
|
|
375
|
+
} | undefined;
|
|
376
|
+
_patternDataResources?: {
|
|
377
|
+
[key: string]: {
|
|
378
|
+
type: string;
|
|
379
|
+
isPatternParameter?: boolean | undefined;
|
|
380
|
+
ignorePatternParameterDefault?: boolean | undefined;
|
|
381
|
+
variables?: {
|
|
382
|
+
[key: string]: string;
|
|
383
|
+
} | undefined;
|
|
384
|
+
};
|
|
385
|
+
} | undefined;
|
|
386
|
+
_patternError?: "NOTFOUND" | "CYCLIC" | undefined;
|
|
387
|
+
_overrides?: {
|
|
388
|
+
[key: string]: {
|
|
389
|
+
parameters?: {
|
|
390
|
+
[key: string]: {
|
|
391
|
+
value: unknown;
|
|
392
|
+
type: string;
|
|
393
|
+
connectedData?: {
|
|
394
|
+
pointer: string;
|
|
395
|
+
syntax: "jptr";
|
|
396
|
+
} | undefined;
|
|
397
|
+
};
|
|
398
|
+
} | undefined;
|
|
399
|
+
variant?: string | undefined;
|
|
400
|
+
};
|
|
401
|
+
} | undefined;
|
|
402
|
+
_overridability?: {
|
|
403
|
+
parameters?: {
|
|
404
|
+
[key: string]: "yes" | "no";
|
|
405
|
+
} | undefined;
|
|
406
|
+
variants?: boolean | undefined;
|
|
407
|
+
} | undefined;
|
|
408
|
+
}[];
|
|
409
|
+
} | undefined;
|
|
410
|
+
_id: string;
|
|
411
|
+
_slug?: string | null | undefined;
|
|
412
|
+
_name: string;
|
|
413
|
+
_dataResources?: {
|
|
414
|
+
[key: string]: {
|
|
415
|
+
type: string;
|
|
416
|
+
isPatternParameter?: boolean | undefined;
|
|
417
|
+
ignorePatternParameterDefault?: boolean | undefined;
|
|
418
|
+
variables?: {
|
|
419
|
+
[key: string]: string;
|
|
420
|
+
} | undefined;
|
|
421
|
+
};
|
|
422
|
+
} | undefined;
|
|
423
|
+
_overrides?: {
|
|
424
|
+
[key: string]: {
|
|
425
|
+
parameters?: {
|
|
426
|
+
[key: string]: {
|
|
427
|
+
value: unknown;
|
|
428
|
+
type: string;
|
|
429
|
+
connectedData?: {
|
|
430
|
+
pointer: string;
|
|
431
|
+
syntax: "jptr";
|
|
432
|
+
} | undefined;
|
|
433
|
+
};
|
|
434
|
+
} | undefined;
|
|
435
|
+
variant?: string | undefined;
|
|
436
|
+
};
|
|
437
|
+
} | undefined;
|
|
438
|
+
_overridability?: {
|
|
439
|
+
parameters?: {
|
|
440
|
+
[key: string]: "yes" | "no";
|
|
441
|
+
} | undefined;
|
|
442
|
+
variants?: boolean | undefined;
|
|
443
|
+
} | undefined;
|
|
444
|
+
} | undefined;
|
|
445
|
+
isContextualEditing: boolean;
|
|
446
|
+
};
|
|
447
|
+
/** @deprecated use UseUniformContextualEditingProps instead */
|
|
448
|
+
type UseContextualEditingProps = UseUniformContextualEditingProps;
|
|
208
449
|
|
|
209
450
|
type UniformCompositionProps<TRenderProps = unknown> = UniformComponentProps<TRenderProps> & {
|
|
210
451
|
/** The composition data */
|
|
@@ -227,6 +468,12 @@ declare function useUniformCurrentComposition(): UniformCompositionContextValue;
|
|
|
227
468
|
* It also takes care of enabling [Contextual Editing](https://docs.uniform.app/capabilities/composition/contextual-editing).
|
|
228
469
|
*/
|
|
229
470
|
declare function UniformComposition<TRenderProps = unknown>({ data, behaviorTracking, children, resolveRenderer, contextualEditingEnhancer, }: UniformCompositionProps<TRenderProps>): JSX.Element;
|
|
471
|
+
/** @deprecated use `useUniformCurrentComposition` instead */
|
|
472
|
+
declare const useComposition: typeof useUniformCurrentComposition;
|
|
473
|
+
/** @deprecated use `UniformComposition` instead */
|
|
474
|
+
declare const Composition: typeof UniformComposition;
|
|
475
|
+
/** @deprecated use `UniformCompositionProps` instead */
|
|
476
|
+
type CompositionProps<TRenderProps = unknown> = UniformCompositionProps<TRenderProps>;
|
|
230
477
|
|
|
231
478
|
type CustomSlotChildRenderFunc = (options: {
|
|
232
479
|
child: ReactNode;
|
|
@@ -252,6 +499,10 @@ type UniformSlotProps<TSlotNames extends string> = {
|
|
|
252
499
|
};
|
|
253
500
|
/** Renders a named Slot within a Composition. */
|
|
254
501
|
declare function UniformSlot<TSlotNames extends string = string>({ name, resolveRenderer, children, emptyPlaceholder, }: UniformSlotProps<TSlotNames>): JSX.Element | null;
|
|
502
|
+
/** @deprecated use `UniformSlotProps` instead */
|
|
503
|
+
type SlotProps<TSlotNames extends string> = UniformSlotProps<TSlotNames>;
|
|
504
|
+
/** @deprecated use `UniformSlot` instead */
|
|
505
|
+
declare const Slot: typeof UniformSlot;
|
|
255
506
|
|
|
256
507
|
type UseCompositionEventEffectOptions = Omit<Partial<SubscribeToCompositionOptions>, 'callback'> & {
|
|
257
508
|
enabled: boolean;
|
|
@@ -276,4 +527,4 @@ declare const createComponentStoreResolver: (options: {
|
|
|
276
527
|
defaultComponent?: React$1.ComponentType<ComponentProps<any>>;
|
|
277
528
|
}) => RenderComponentResolver;
|
|
278
529
|
|
|
279
|
-
export { ComponentProps, ComponentStore, DefaultNotImplementedComponent, NOT_IMPLEMENTED_COMPONENT, RenderComponentResolver, SystemRenderConfig, SystemRenderFunction, UniformComponent, UniformComponentContextValue, UniformComponentProps, UniformComposition, UniformCompositionProps, UniformSlot, UniformSlotProps, UseCompositionEventEffectOptions, UseUniformContextualEditingProps, componentStore, componentStoreResolver, createComponentStore, createComponentStoreResolver, registerUniformComponent, useCompositionEventEffect, useUniformContextualEditing, useUniformCurrentComponent, useUniformCurrentComposition };
|
|
530
|
+
export { ComponentProps, ComponentStore, Composition, CompositionProps, DefaultNotImplementedComponent, NOT_IMPLEMENTED_COMPONENT, RenderComponentResolver, Slot, SlotProps, SystemRenderConfig, SystemRenderFunction, UniformComponent, UniformComponentContextValue, UniformComponentProps, UniformComposition, UniformCompositionProps, UniformSlot, UniformSlotProps, UseCompositionEventEffectOptions, UseContextualEditingProps, UseUniformContextualEditingProps, componentStore, componentStoreResolver, createApiEnhancer, createComponentStore, createComponentStoreResolver, registerUniformComponent, useComposition, useCompositionEventEffect, useContextualEditing, useUniformContextualEditing, useUniformCurrentComponent, useUniformCurrentComposition };
|
package/dist/index.esm.js
CHANGED
|
@@ -165,6 +165,7 @@ import {
|
|
|
165
165
|
isUpdateCompositionMessage
|
|
166
166
|
} from "@uniformdev/canvas";
|
|
167
167
|
import { useEffect, useMemo, useState } from "react";
|
|
168
|
+
var createApiEnhancer = createUniformApiEnhancer;
|
|
168
169
|
var registeredCompositionIds = /* @__PURE__ */ new Set();
|
|
169
170
|
var useUniformContextualEditing = ({
|
|
170
171
|
initialCompositionValue,
|
|
@@ -243,6 +244,7 @@ function isInContextEditingMode() {
|
|
|
243
244
|
);
|
|
244
245
|
return isOpenedByInContextEditor && isAllowlistedReferrer;
|
|
245
246
|
}
|
|
247
|
+
var useContextualEditing = useUniformContextualEditing;
|
|
246
248
|
|
|
247
249
|
// src/components/UniformComposition.tsx
|
|
248
250
|
var UniformCompositionContext = createContext({
|
|
@@ -279,6 +281,8 @@ function UniformComposition({
|
|
|
279
281
|
))
|
|
280
282
|
);
|
|
281
283
|
}
|
|
284
|
+
var useComposition = useUniformCurrentComposition;
|
|
285
|
+
var Composition = UniformComposition;
|
|
282
286
|
|
|
283
287
|
// src/components/ContextualEditingComponentWrapper.tsx
|
|
284
288
|
function ContextualEditingComponentWrapper({
|
|
@@ -293,7 +297,7 @@ function ContextualEditingComponentWrapper({
|
|
|
293
297
|
var _a, _b, _c, _d;
|
|
294
298
|
const isPlaceholder = (component == null ? void 0 : component._id) === PLACEHOLDER_ID;
|
|
295
299
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
296
|
-
return !isContextualEditing ? /* @__PURE__ */ React4.createElement(React4.Fragment, null, children) : /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(
|
|
300
|
+
return !isContextualEditing ? /* @__PURE__ */ React4.createElement(React4.Fragment, null, children) : isPlaceholder && emptyPlaceholder === null ? null : /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(
|
|
297
301
|
"script",
|
|
298
302
|
{
|
|
299
303
|
"data-role": IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
|
|
@@ -427,6 +431,7 @@ function renderComponent({
|
|
|
427
431
|
}
|
|
428
432
|
return null;
|
|
429
433
|
}
|
|
434
|
+
var Slot = UniformSlot;
|
|
430
435
|
|
|
431
436
|
// src/components/UniformComponent.tsx
|
|
432
437
|
var UniformComponentContext = createContext2({});
|
|
@@ -480,7 +485,7 @@ function resolveChildren({
|
|
|
480
485
|
} else {
|
|
481
486
|
if (Object.keys((_a = data.slots) != null ? _a : {}).length > 1 && process.env.NODE_ENV === "development") {
|
|
482
487
|
console.warn(
|
|
483
|
-
`[canvas-dev] All the slots in component '${data.type}' are rendered in no particular order. Use '<
|
|
488
|
+
`[canvas-dev] All the slots in component '${data.type}' are rendered in no particular order. Use '<Slot name={slotName} />' to reliably render the slots.`
|
|
484
489
|
);
|
|
485
490
|
}
|
|
486
491
|
children = Object.keys(data.slots || {}).map((slotName) => /* @__PURE__ */ React6.createElement(UniformSlot, { key: slotName, name: slotName }));
|
|
@@ -530,18 +535,23 @@ function useCompositionEventEffect({
|
|
|
530
535
|
}, [compositionId, enabled, projectId, effect]);
|
|
531
536
|
}
|
|
532
537
|
export {
|
|
538
|
+
Composition,
|
|
533
539
|
DefaultNotImplementedComponent,
|
|
534
540
|
NOT_IMPLEMENTED_COMPONENT,
|
|
541
|
+
Slot,
|
|
535
542
|
UniformComponent,
|
|
536
543
|
UniformComposition,
|
|
537
544
|
UniformSlot,
|
|
538
545
|
componentStore,
|
|
539
546
|
componentStoreResolver,
|
|
547
|
+
createApiEnhancer,
|
|
540
548
|
createComponentStore,
|
|
541
549
|
createComponentStoreResolver,
|
|
542
550
|
createUniformApiEnhancer,
|
|
543
551
|
registerUniformComponent,
|
|
552
|
+
useComposition,
|
|
544
553
|
useCompositionEventEffect,
|
|
554
|
+
useContextualEditing,
|
|
545
555
|
useUniformContextualEditing,
|
|
546
556
|
useUniformCurrentComponent,
|
|
547
557
|
useUniformCurrentComposition
|
package/dist/index.js
CHANGED
|
@@ -30,18 +30,23 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
+
Composition: () => Composition,
|
|
33
34
|
DefaultNotImplementedComponent: () => DefaultNotImplementedComponent,
|
|
34
35
|
NOT_IMPLEMENTED_COMPONENT: () => NOT_IMPLEMENTED_COMPONENT,
|
|
36
|
+
Slot: () => Slot,
|
|
35
37
|
UniformComponent: () => UniformComponent,
|
|
36
38
|
UniformComposition: () => UniformComposition,
|
|
37
39
|
UniformSlot: () => UniformSlot,
|
|
38
40
|
componentStore: () => componentStore,
|
|
39
41
|
componentStoreResolver: () => componentStoreResolver,
|
|
42
|
+
createApiEnhancer: () => createApiEnhancer,
|
|
40
43
|
createComponentStore: () => createComponentStore,
|
|
41
44
|
createComponentStoreResolver: () => createComponentStoreResolver,
|
|
42
45
|
createUniformApiEnhancer: () => import_canvas3.createUniformApiEnhancer,
|
|
43
46
|
registerUniformComponent: () => registerUniformComponent,
|
|
47
|
+
useComposition: () => useComposition,
|
|
44
48
|
useCompositionEventEffect: () => useCompositionEventEffect,
|
|
49
|
+
useContextualEditing: () => useContextualEditing,
|
|
45
50
|
useUniformContextualEditing: () => useUniformContextualEditing,
|
|
46
51
|
useUniformCurrentComponent: () => useUniformCurrentComponent,
|
|
47
52
|
useUniformCurrentComposition: () => useUniformCurrentComposition
|
|
@@ -193,6 +198,7 @@ var import_react3 = __toESM(require("react"));
|
|
|
193
198
|
// src/hooks/useUniformContextualEditing.ts
|
|
194
199
|
var import_canvas3 = require("@uniformdev/canvas");
|
|
195
200
|
var import_react2 = require("react");
|
|
201
|
+
var createApiEnhancer = import_canvas3.createUniformApiEnhancer;
|
|
196
202
|
var registeredCompositionIds = /* @__PURE__ */ new Set();
|
|
197
203
|
var useUniformContextualEditing = ({
|
|
198
204
|
initialCompositionValue,
|
|
@@ -271,6 +277,7 @@ function isInContextEditingMode() {
|
|
|
271
277
|
);
|
|
272
278
|
return isOpenedByInContextEditor && isAllowlistedReferrer;
|
|
273
279
|
}
|
|
280
|
+
var useContextualEditing = useUniformContextualEditing;
|
|
274
281
|
|
|
275
282
|
// src/components/UniformComposition.tsx
|
|
276
283
|
var UniformCompositionContext = (0, import_react3.createContext)({
|
|
@@ -307,6 +314,8 @@ function UniformComposition({
|
|
|
307
314
|
))
|
|
308
315
|
);
|
|
309
316
|
}
|
|
317
|
+
var useComposition = useUniformCurrentComposition;
|
|
318
|
+
var Composition = UniformComposition;
|
|
310
319
|
|
|
311
320
|
// src/components/ContextualEditingComponentWrapper.tsx
|
|
312
321
|
function ContextualEditingComponentWrapper({
|
|
@@ -321,7 +330,7 @@ function ContextualEditingComponentWrapper({
|
|
|
321
330
|
var _a, _b, _c, _d;
|
|
322
331
|
const isPlaceholder = (component == null ? void 0 : component._id) === import_canvas4.PLACEHOLDER_ID;
|
|
323
332
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
324
|
-
return !isContextualEditing ? /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, children) : /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement(
|
|
333
|
+
return !isContextualEditing ? /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, children) : isPlaceholder && emptyPlaceholder === null ? null : /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement(
|
|
325
334
|
"script",
|
|
326
335
|
{
|
|
327
336
|
"data-role": import_canvas4.IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
|
|
@@ -455,6 +464,7 @@ function renderComponent({
|
|
|
455
464
|
}
|
|
456
465
|
return null;
|
|
457
466
|
}
|
|
467
|
+
var Slot = UniformSlot;
|
|
458
468
|
|
|
459
469
|
// src/components/UniformComponent.tsx
|
|
460
470
|
var UniformComponentContext = (0, import_react6.createContext)({});
|
|
@@ -508,7 +518,7 @@ function resolveChildren({
|
|
|
508
518
|
} else {
|
|
509
519
|
if (Object.keys((_a = data.slots) != null ? _a : {}).length > 1 && process.env.NODE_ENV === "development") {
|
|
510
520
|
console.warn(
|
|
511
|
-
`[canvas-dev] All the slots in component '${data.type}' are rendered in no particular order. Use '<
|
|
521
|
+
`[canvas-dev] All the slots in component '${data.type}' are rendered in no particular order. Use '<Slot name={slotName} />' to reliably render the slots.`
|
|
512
522
|
);
|
|
513
523
|
}
|
|
514
524
|
children = Object.keys(data.slots || {}).map((slotName) => /* @__PURE__ */ import_react6.default.createElement(UniformSlot, { key: slotName, name: slotName }));
|
|
@@ -555,18 +565,23 @@ function useCompositionEventEffect({
|
|
|
555
565
|
}
|
|
556
566
|
// Annotate the CommonJS export names for ESM import in node:
|
|
557
567
|
0 && (module.exports = {
|
|
568
|
+
Composition,
|
|
558
569
|
DefaultNotImplementedComponent,
|
|
559
570
|
NOT_IMPLEMENTED_COMPONENT,
|
|
571
|
+
Slot,
|
|
560
572
|
UniformComponent,
|
|
561
573
|
UniformComposition,
|
|
562
574
|
UniformSlot,
|
|
563
575
|
componentStore,
|
|
564
576
|
componentStoreResolver,
|
|
577
|
+
createApiEnhancer,
|
|
565
578
|
createComponentStore,
|
|
566
579
|
createComponentStoreResolver,
|
|
567
580
|
createUniformApiEnhancer,
|
|
568
581
|
registerUniformComponent,
|
|
582
|
+
useComposition,
|
|
569
583
|
useCompositionEventEffect,
|
|
584
|
+
useContextualEditing,
|
|
570
585
|
useUniformContextualEditing,
|
|
571
586
|
useUniformCurrentComponent,
|
|
572
587
|
useUniformCurrentComposition
|
package/dist/index.mjs
CHANGED
|
@@ -165,6 +165,7 @@ import {
|
|
|
165
165
|
isUpdateCompositionMessage
|
|
166
166
|
} from "@uniformdev/canvas";
|
|
167
167
|
import { useEffect, useMemo, useState } from "react";
|
|
168
|
+
var createApiEnhancer = createUniformApiEnhancer;
|
|
168
169
|
var registeredCompositionIds = /* @__PURE__ */ new Set();
|
|
169
170
|
var useUniformContextualEditing = ({
|
|
170
171
|
initialCompositionValue,
|
|
@@ -243,6 +244,7 @@ function isInContextEditingMode() {
|
|
|
243
244
|
);
|
|
244
245
|
return isOpenedByInContextEditor && isAllowlistedReferrer;
|
|
245
246
|
}
|
|
247
|
+
var useContextualEditing = useUniformContextualEditing;
|
|
246
248
|
|
|
247
249
|
// src/components/UniformComposition.tsx
|
|
248
250
|
var UniformCompositionContext = createContext({
|
|
@@ -279,6 +281,8 @@ function UniformComposition({
|
|
|
279
281
|
))
|
|
280
282
|
);
|
|
281
283
|
}
|
|
284
|
+
var useComposition = useUniformCurrentComposition;
|
|
285
|
+
var Composition = UniformComposition;
|
|
282
286
|
|
|
283
287
|
// src/components/ContextualEditingComponentWrapper.tsx
|
|
284
288
|
function ContextualEditingComponentWrapper({
|
|
@@ -293,7 +297,7 @@ function ContextualEditingComponentWrapper({
|
|
|
293
297
|
var _a, _b, _c, _d;
|
|
294
298
|
const isPlaceholder = (component == null ? void 0 : component._id) === PLACEHOLDER_ID;
|
|
295
299
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
296
|
-
return !isContextualEditing ? /* @__PURE__ */ React4.createElement(React4.Fragment, null, children) : /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(
|
|
300
|
+
return !isContextualEditing ? /* @__PURE__ */ React4.createElement(React4.Fragment, null, children) : isPlaceholder && emptyPlaceholder === null ? null : /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(
|
|
297
301
|
"script",
|
|
298
302
|
{
|
|
299
303
|
"data-role": IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
|
|
@@ -427,6 +431,7 @@ function renderComponent({
|
|
|
427
431
|
}
|
|
428
432
|
return null;
|
|
429
433
|
}
|
|
434
|
+
var Slot = UniformSlot;
|
|
430
435
|
|
|
431
436
|
// src/components/UniformComponent.tsx
|
|
432
437
|
var UniformComponentContext = createContext2({});
|
|
@@ -480,7 +485,7 @@ function resolveChildren({
|
|
|
480
485
|
} else {
|
|
481
486
|
if (Object.keys((_a = data.slots) != null ? _a : {}).length > 1 && process.env.NODE_ENV === "development") {
|
|
482
487
|
console.warn(
|
|
483
|
-
`[canvas-dev] All the slots in component '${data.type}' are rendered in no particular order. Use '<
|
|
488
|
+
`[canvas-dev] All the slots in component '${data.type}' are rendered in no particular order. Use '<Slot name={slotName} />' to reliably render the slots.`
|
|
484
489
|
);
|
|
485
490
|
}
|
|
486
491
|
children = Object.keys(data.slots || {}).map((slotName) => /* @__PURE__ */ React6.createElement(UniformSlot, { key: slotName, name: slotName }));
|
|
@@ -530,18 +535,23 @@ function useCompositionEventEffect({
|
|
|
530
535
|
}, [compositionId, enabled, projectId, effect]);
|
|
531
536
|
}
|
|
532
537
|
export {
|
|
538
|
+
Composition,
|
|
533
539
|
DefaultNotImplementedComponent,
|
|
534
540
|
NOT_IMPLEMENTED_COMPONENT,
|
|
541
|
+
Slot,
|
|
535
542
|
UniformComponent,
|
|
536
543
|
UniformComposition,
|
|
537
544
|
UniformSlot,
|
|
538
545
|
componentStore,
|
|
539
546
|
componentStoreResolver,
|
|
547
|
+
createApiEnhancer,
|
|
540
548
|
createComponentStore,
|
|
541
549
|
createComponentStoreResolver,
|
|
542
550
|
createUniformApiEnhancer,
|
|
543
551
|
registerUniformComponent,
|
|
552
|
+
useComposition,
|
|
544
553
|
useCompositionEventEffect,
|
|
554
|
+
useContextualEditing,
|
|
545
555
|
useUniformContextualEditing,
|
|
546
556
|
useUniformCurrentComponent,
|
|
547
557
|
useUniformCurrentComposition
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-react",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.38.1-alpha.10+13f006c1d",
|
|
4
4
|
"description": "React SDK for Uniform Canvas",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,16 +24,16 @@
|
|
|
24
24
|
"document": "api-extractor run --local"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@uniformdev/canvas": "18.
|
|
28
|
-
"@uniformdev/context": "18.
|
|
29
|
-
"@uniformdev/context-react": "18.
|
|
27
|
+
"@uniformdev/canvas": "18.38.1-alpha.10+13f006c1d",
|
|
28
|
+
"@uniformdev/context": "18.38.1-alpha.10+13f006c1d",
|
|
29
|
+
"@uniformdev/context-react": "18.38.1-alpha.10+13f006c1d"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": ">= 16 || 17 || 18",
|
|
33
33
|
"react-dom": ">=16"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/react": "18.0.
|
|
36
|
+
"@types/react": "18.0.35",
|
|
37
37
|
"react": "18.2.0",
|
|
38
38
|
"react-dom": "18.2.0"
|
|
39
39
|
},
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "13f006c1d5ebbe593d33f3446a8de84b4a2d42d1"
|
|
47
47
|
}
|