@uniformdev/canvas-react 18.5.0 → 18.6.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 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: ComponentInstance | RootComponentInstance;
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: RootComponentInstance;
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: RootComponentInstance;
320
+ data?: RootComponentInstance;
321
321
  contextualEditingEnhancer?: UseUniformContextualEditingProps['enhance'];
322
322
  };
323
323
  type UniformCompositionContextValue = {
324
- data?: UniformCompositionProps['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;
@@ -389,7 +389,7 @@ function isInContextEditingMode() {
389
389
  var useContextualEditing = useUniformContextualEditing;
390
390
 
391
391
  // src/components/UniformComposition.tsx
392
- var UniformCompositionContext = createContext2({});
392
+ var UniformCompositionContext = createContext2({ data: void 0 });
393
393
  function useUniformCurrentComposition() {
394
394
  return useContext2(UniformCompositionContext);
395
395
  }
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;
@@ -422,7 +422,7 @@ function isInContextEditingMode() {
422
422
  var useContextualEditing = useUniformContextualEditing;
423
423
 
424
424
  // src/components/UniformComposition.tsx
425
- var UniformCompositionContext = (0, import_react5.createContext)({});
425
+ var UniformCompositionContext = (0, import_react5.createContext)({ data: void 0 });
426
426
  function useUniformCurrentComposition() {
427
427
  return (0, import_react5.useContext)(UniformCompositionContext);
428
428
  }
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;
@@ -389,7 +389,7 @@ function isInContextEditingMode() {
389
389
  var useContextualEditing = useUniformContextualEditing;
390
390
 
391
391
  // src/components/UniformComposition.tsx
392
- var UniformCompositionContext = createContext2({});
392
+ var UniformCompositionContext = createContext2({ data: void 0 });
393
393
  function useUniformCurrentComposition() {
394
394
  return useContext2(UniformCompositionContext);
395
395
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-react",
3
- "version": "18.5.0",
3
+ "version": "18.6.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.5.0",
27
- "@uniformdev/context": "18.5.0",
28
- "@uniformdev/context-react": "18.5.0"
26
+ "@uniformdev/canvas": "18.6.0",
27
+ "@uniformdev/context": "18.6.0",
28
+ "@uniformdev/context-react": "18.6.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": "757923e90bece28162621d867709e08674bdaa05"
45
+ "gitHead": "2e2b4d179180900386f8b3ceb30d4a854a7e22fd"
46
46
  }