@uniformdev/canvas-react 18.5.0 → 18.7.0
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 +6 -6
- package/dist/index.esm.js +8 -5
- package/dist/index.js +8 -5
- package/dist/index.mjs +8 -5
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ declare function DefaultNotImplementedComponent(props: ComponentProps): JSX.Elem
|
|
|
40
40
|
|
|
41
41
|
type UniformComponentProps<TRenderProps = unknown> = {
|
|
42
42
|
/** The data of the component instance */
|
|
43
|
-
data
|
|
43
|
+
data?: ComponentInstance | RootComponentInstance;
|
|
44
44
|
/** Resolves a React component to render a Canvas component, generally by inspecting type/variant */
|
|
45
45
|
resolveRenderer?: RenderComponentResolver;
|
|
46
46
|
/** Children to render. Can also be a function that takes ComponentProps as argument */
|
|
@@ -150,7 +150,7 @@ declare const createApiEnhancer: ({ apiUrl }: {
|
|
|
150
150
|
} | undefined;
|
|
151
151
|
}>;
|
|
152
152
|
type UseUniformContextualEditingProps = {
|
|
153
|
-
initialCompositionValue
|
|
153
|
+
initialCompositionValue?: RootComponentInstance;
|
|
154
154
|
/**
|
|
155
155
|
* A function to enhance the composition after receiving it from Canvas editor.
|
|
156
156
|
* WARNING: This enhancer will run on the client side. Make sure you're not exposing any secrets. You can use `createApiEnhancer` to create an enhancer based on an API route.
|
|
@@ -234,7 +234,7 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
|
|
|
234
234
|
} | undefined;
|
|
235
235
|
};
|
|
236
236
|
} | undefined;
|
|
237
|
-
};
|
|
237
|
+
} | undefined;
|
|
238
238
|
};
|
|
239
239
|
/** @deprecated use useUniformContextualEditing instead */
|
|
240
240
|
declare const useContextualEditing: ({ initialCompositionValue, enhance, }: UseUniformContextualEditingProps) => {
|
|
@@ -310,18 +310,18 @@ declare const useContextualEditing: ({ initialCompositionValue, enhance, }: UseU
|
|
|
310
310
|
} | undefined;
|
|
311
311
|
};
|
|
312
312
|
} | undefined;
|
|
313
|
-
};
|
|
313
|
+
} | undefined;
|
|
314
314
|
};
|
|
315
315
|
/** @deprecated use UseUniformContextualEditingProps instead */
|
|
316
316
|
type UseContextualEditingProps = UseUniformContextualEditingProps;
|
|
317
317
|
|
|
318
318
|
type UniformCompositionProps<TRenderProps = unknown> = UniformComponentProps<TRenderProps> & {
|
|
319
319
|
/** The composition data */
|
|
320
|
-
data
|
|
320
|
+
data?: RootComponentInstance;
|
|
321
321
|
contextualEditingEnhancer?: UseUniformContextualEditingProps['enhance'];
|
|
322
322
|
};
|
|
323
323
|
type UniformCompositionContextValue = {
|
|
324
|
-
data
|
|
324
|
+
data: UniformCompositionProps['data'] | undefined;
|
|
325
325
|
resolveRenderer?: UniformCompositionProps['resolveRenderer'];
|
|
326
326
|
behaviorTracking?: UniformCompositionProps['behaviorTracking'];
|
|
327
327
|
};
|
package/dist/index.esm.js
CHANGED
|
@@ -336,7 +336,7 @@ var useUniformContextualEditing = ({
|
|
|
336
336
|
return channel2;
|
|
337
337
|
}, []);
|
|
338
338
|
useEffect(() => {
|
|
339
|
-
if (!channel || registeredCompositionIds.has(initialCompositionValue._id)) {
|
|
339
|
+
if (!channel || registeredCompositionIds.has(initialCompositionValue == null ? void 0 : initialCompositionValue._id)) {
|
|
340
340
|
return;
|
|
341
341
|
}
|
|
342
342
|
const unsubscribe = channel.on("update-composition", async (message) => {
|
|
@@ -346,12 +346,12 @@ var useUniformContextualEditing = ({
|
|
|
346
346
|
const enhancedComposition = await enhance(message);
|
|
347
347
|
setContextualComposition(enhancedComposition);
|
|
348
348
|
});
|
|
349
|
-
registeredCompositionIds.add(initialCompositionValue._id);
|
|
349
|
+
registeredCompositionIds.add(initialCompositionValue == null ? void 0 : initialCompositionValue._id);
|
|
350
350
|
return () => {
|
|
351
351
|
unsubscribe();
|
|
352
|
-
registeredCompositionIds.delete(initialCompositionValue._id);
|
|
352
|
+
registeredCompositionIds.delete(initialCompositionValue == null ? void 0 : initialCompositionValue._id);
|
|
353
353
|
};
|
|
354
|
-
}, [channel, enhance, initialCompositionValue._id]);
|
|
354
|
+
}, [channel, enhance, initialCompositionValue == null ? void 0 : initialCompositionValue._id]);
|
|
355
355
|
useEffect(() => {
|
|
356
356
|
if (!isInContextEditingMode()) {
|
|
357
357
|
return;
|
|
@@ -360,6 +360,9 @@ var useUniformContextualEditing = ({
|
|
|
360
360
|
if (existingScript) {
|
|
361
361
|
return;
|
|
362
362
|
}
|
|
363
|
+
window.__UNIFORM_CONTEXTUAL_EDITING__ = {
|
|
364
|
+
framework: "React"
|
|
365
|
+
};
|
|
363
366
|
const script = document.createElement("script");
|
|
364
367
|
script.id = IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID;
|
|
365
368
|
script.src = getCanvasInContextEmbedScriptUrl();
|
|
@@ -389,7 +392,7 @@ function isInContextEditingMode() {
|
|
|
389
392
|
var useContextualEditing = useUniformContextualEditing;
|
|
390
393
|
|
|
391
394
|
// src/components/UniformComposition.tsx
|
|
392
|
-
var UniformCompositionContext = createContext2({});
|
|
395
|
+
var UniformCompositionContext = createContext2({ data: void 0 });
|
|
393
396
|
function useUniformCurrentComposition() {
|
|
394
397
|
return useContext2(UniformCompositionContext);
|
|
395
398
|
}
|
package/dist/index.js
CHANGED
|
@@ -369,7 +369,7 @@ var useUniformContextualEditing = ({
|
|
|
369
369
|
return channel2;
|
|
370
370
|
}, []);
|
|
371
371
|
(0, import_react4.useEffect)(() => {
|
|
372
|
-
if (!channel || registeredCompositionIds.has(initialCompositionValue._id)) {
|
|
372
|
+
if (!channel || registeredCompositionIds.has(initialCompositionValue == null ? void 0 : initialCompositionValue._id)) {
|
|
373
373
|
return;
|
|
374
374
|
}
|
|
375
375
|
const unsubscribe = channel.on("update-composition", async (message) => {
|
|
@@ -379,12 +379,12 @@ var useUniformContextualEditing = ({
|
|
|
379
379
|
const enhancedComposition = await enhance(message);
|
|
380
380
|
setContextualComposition(enhancedComposition);
|
|
381
381
|
});
|
|
382
|
-
registeredCompositionIds.add(initialCompositionValue._id);
|
|
382
|
+
registeredCompositionIds.add(initialCompositionValue == null ? void 0 : initialCompositionValue._id);
|
|
383
383
|
return () => {
|
|
384
384
|
unsubscribe();
|
|
385
|
-
registeredCompositionIds.delete(initialCompositionValue._id);
|
|
385
|
+
registeredCompositionIds.delete(initialCompositionValue == null ? void 0 : initialCompositionValue._id);
|
|
386
386
|
};
|
|
387
|
-
}, [channel, enhance, initialCompositionValue._id]);
|
|
387
|
+
}, [channel, enhance, initialCompositionValue == null ? void 0 : initialCompositionValue._id]);
|
|
388
388
|
(0, import_react4.useEffect)(() => {
|
|
389
389
|
if (!isInContextEditingMode()) {
|
|
390
390
|
return;
|
|
@@ -393,6 +393,9 @@ var useUniformContextualEditing = ({
|
|
|
393
393
|
if (existingScript) {
|
|
394
394
|
return;
|
|
395
395
|
}
|
|
396
|
+
window.__UNIFORM_CONTEXTUAL_EDITING__ = {
|
|
397
|
+
framework: "React"
|
|
398
|
+
};
|
|
396
399
|
const script = document.createElement("script");
|
|
397
400
|
script.id = import_canvas5.IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID;
|
|
398
401
|
script.src = getCanvasInContextEmbedScriptUrl();
|
|
@@ -422,7 +425,7 @@ function isInContextEditingMode() {
|
|
|
422
425
|
var useContextualEditing = useUniformContextualEditing;
|
|
423
426
|
|
|
424
427
|
// src/components/UniformComposition.tsx
|
|
425
|
-
var UniformCompositionContext = (0, import_react5.createContext)({});
|
|
428
|
+
var UniformCompositionContext = (0, import_react5.createContext)({ data: void 0 });
|
|
426
429
|
function useUniformCurrentComposition() {
|
|
427
430
|
return (0, import_react5.useContext)(UniformCompositionContext);
|
|
428
431
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -336,7 +336,7 @@ var useUniformContextualEditing = ({
|
|
|
336
336
|
return channel2;
|
|
337
337
|
}, []);
|
|
338
338
|
useEffect(() => {
|
|
339
|
-
if (!channel || registeredCompositionIds.has(initialCompositionValue._id)) {
|
|
339
|
+
if (!channel || registeredCompositionIds.has(initialCompositionValue == null ? void 0 : initialCompositionValue._id)) {
|
|
340
340
|
return;
|
|
341
341
|
}
|
|
342
342
|
const unsubscribe = channel.on("update-composition", async (message) => {
|
|
@@ -346,12 +346,12 @@ var useUniformContextualEditing = ({
|
|
|
346
346
|
const enhancedComposition = await enhance(message);
|
|
347
347
|
setContextualComposition(enhancedComposition);
|
|
348
348
|
});
|
|
349
|
-
registeredCompositionIds.add(initialCompositionValue._id);
|
|
349
|
+
registeredCompositionIds.add(initialCompositionValue == null ? void 0 : initialCompositionValue._id);
|
|
350
350
|
return () => {
|
|
351
351
|
unsubscribe();
|
|
352
|
-
registeredCompositionIds.delete(initialCompositionValue._id);
|
|
352
|
+
registeredCompositionIds.delete(initialCompositionValue == null ? void 0 : initialCompositionValue._id);
|
|
353
353
|
};
|
|
354
|
-
}, [channel, enhance, initialCompositionValue._id]);
|
|
354
|
+
}, [channel, enhance, initialCompositionValue == null ? void 0 : initialCompositionValue._id]);
|
|
355
355
|
useEffect(() => {
|
|
356
356
|
if (!isInContextEditingMode()) {
|
|
357
357
|
return;
|
|
@@ -360,6 +360,9 @@ var useUniformContextualEditing = ({
|
|
|
360
360
|
if (existingScript) {
|
|
361
361
|
return;
|
|
362
362
|
}
|
|
363
|
+
window.__UNIFORM_CONTEXTUAL_EDITING__ = {
|
|
364
|
+
framework: "React"
|
|
365
|
+
};
|
|
363
366
|
const script = document.createElement("script");
|
|
364
367
|
script.id = IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID;
|
|
365
368
|
script.src = getCanvasInContextEmbedScriptUrl();
|
|
@@ -389,7 +392,7 @@ function isInContextEditingMode() {
|
|
|
389
392
|
var useContextualEditing = useUniformContextualEditing;
|
|
390
393
|
|
|
391
394
|
// src/components/UniformComposition.tsx
|
|
392
|
-
var UniformCompositionContext = createContext2({});
|
|
395
|
+
var UniformCompositionContext = createContext2({ data: void 0 });
|
|
393
396
|
function useUniformCurrentComposition() {
|
|
394
397
|
return useContext2(UniformCompositionContext);
|
|
395
398
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-react",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.7.0",
|
|
4
4
|
"description": "React SDK for Uniform Canvas",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"format": "prettier --write \"src/**/*.{js,ts,tsx}\""
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@uniformdev/canvas": "18.
|
|
27
|
-
"@uniformdev/context": "18.
|
|
28
|
-
"@uniformdev/context-react": "18.
|
|
26
|
+
"@uniformdev/canvas": "18.7.0",
|
|
27
|
+
"@uniformdev/context": "18.7.0",
|
|
28
|
+
"@uniformdev/context-react": "18.7.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"react": ">= 16 || 17 || 18",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "eaf3d0e5c1c124d6b449a2f2b16b327d6f3d3666"
|
|
46
46
|
}
|