@uniformdev/canvas-react 18.35.1-alpha.16 → 18.35.1-alpha.17

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
@@ -524,7 +524,7 @@ type UniformTextProps = {
524
524
  */
525
525
  render?: (value: ParameterTextValue) => React$1.ReactNode;
526
526
  } & Omit<React$1.HTMLAttributes<HTMLSpanElement>, 'children'>;
527
- declare const UniformText: ({ as: Tag, parameterId, isMultiline, render, ...props }: UniformTextProps) => JSX.Element;
527
+ declare const UniformText: ({ as: Tag, parameterId, isMultiline, render, ...props }: UniformTextProps) => JSX.Element | null;
528
528
 
529
529
  type UseCompositionEventEffectOptions = Omit<Partial<SubscribeToCompositionOptions>, 'callback'> & {
530
530
  enabled: boolean;
package/dist/index.esm.js CHANGED
@@ -533,14 +533,15 @@ var UniformText = ({
533
533
  const { isContextualEditing } = useUniformCurrentComposition();
534
534
  const elementRef = useRef(null);
535
535
  const [isFocused, setIsFocused] = useState2(false);
536
- const value = useMemo2(() => {
536
+ const parameter = useMemo2(() => {
537
537
  var _a;
538
- return (_a = componentData == null ? void 0 : componentData.parameters) == null ? void 0 : _a[parameterId].value;
538
+ return (_a = componentData == null ? void 0 : componentData.parameters) == null ? void 0 : _a[parameterId];
539
539
  }, [componentData, parameterId]);
540
+ const value = useMemo2(() => parameter == null ? void 0 : parameter.value, [parameter]);
540
541
  const isEditable = useMemo2(() => {
541
- var _a, _b, _c;
542
- return (_c = (_b = ((_a = componentData == null ? void 0 : componentData.parameters) == null ? void 0 : _a[parameterId])._contextualEditing) == null ? void 0 : _b.isEditable) != null ? _c : false;
543
- }, [componentData, parameterId]);
542
+ var _a, _b;
543
+ return (_b = (_a = parameter == null ? void 0 : parameter._contextualEditing) == null ? void 0 : _a.isEditable) != null ? _b : false;
544
+ }, [parameter]);
544
545
  const handleOnFocus = useCallback(() => {
545
546
  setIsFocused(true);
546
547
  }, [setIsFocused]);
@@ -548,6 +549,12 @@ var UniformText = ({
548
549
  setIsFocused(false);
549
550
  }, [setIsFocused]);
550
551
  const shouldSkipCustomRendering = useMemo2(() => isFocused && isEditable, [isFocused, isEditable]);
552
+ if (!parameter) {
553
+ console.warn(
554
+ `UniformText: The parameterId "${parameterId}" was not found in the component of type "${componentData == null ? void 0 : componentData.type}"`
555
+ );
556
+ return null;
557
+ }
551
558
  if (!isContextualEditing) {
552
559
  return /* @__PURE__ */ React7.createElement(Tag, { style: isMultiline ? { whiteSpace: "pre-wrap" } : {}, ...props }, render(value));
553
560
  }
package/dist/index.js CHANGED
@@ -567,14 +567,15 @@ var UniformText = ({
567
567
  const { isContextualEditing } = useUniformCurrentComposition();
568
568
  const elementRef = (0, import_react7.useRef)(null);
569
569
  const [isFocused, setIsFocused] = (0, import_react7.useState)(false);
570
- const value = (0, import_react7.useMemo)(() => {
570
+ const parameter = (0, import_react7.useMemo)(() => {
571
571
  var _a;
572
- return (_a = componentData == null ? void 0 : componentData.parameters) == null ? void 0 : _a[parameterId].value;
572
+ return (_a = componentData == null ? void 0 : componentData.parameters) == null ? void 0 : _a[parameterId];
573
573
  }, [componentData, parameterId]);
574
+ const value = (0, import_react7.useMemo)(() => parameter == null ? void 0 : parameter.value, [parameter]);
574
575
  const isEditable = (0, import_react7.useMemo)(() => {
575
- var _a, _b, _c;
576
- return (_c = (_b = ((_a = componentData == null ? void 0 : componentData.parameters) == null ? void 0 : _a[parameterId])._contextualEditing) == null ? void 0 : _b.isEditable) != null ? _c : false;
577
- }, [componentData, parameterId]);
576
+ var _a, _b;
577
+ return (_b = (_a = parameter == null ? void 0 : parameter._contextualEditing) == null ? void 0 : _a.isEditable) != null ? _b : false;
578
+ }, [parameter]);
578
579
  const handleOnFocus = (0, import_react7.useCallback)(() => {
579
580
  setIsFocused(true);
580
581
  }, [setIsFocused]);
@@ -582,6 +583,12 @@ var UniformText = ({
582
583
  setIsFocused(false);
583
584
  }, [setIsFocused]);
584
585
  const shouldSkipCustomRendering = (0, import_react7.useMemo)(() => isFocused && isEditable, [isFocused, isEditable]);
586
+ if (!parameter) {
587
+ console.warn(
588
+ `UniformText: The parameterId "${parameterId}" was not found in the component of type "${componentData == null ? void 0 : componentData.type}"`
589
+ );
590
+ return null;
591
+ }
585
592
  if (!isContextualEditing) {
586
593
  return /* @__PURE__ */ import_react7.default.createElement(Tag, { style: isMultiline ? { whiteSpace: "pre-wrap" } : {}, ...props }, render(value));
587
594
  }
package/dist/index.mjs CHANGED
@@ -533,14 +533,15 @@ var UniformText = ({
533
533
  const { isContextualEditing } = useUniformCurrentComposition();
534
534
  const elementRef = useRef(null);
535
535
  const [isFocused, setIsFocused] = useState2(false);
536
- const value = useMemo2(() => {
536
+ const parameter = useMemo2(() => {
537
537
  var _a;
538
- return (_a = componentData == null ? void 0 : componentData.parameters) == null ? void 0 : _a[parameterId].value;
538
+ return (_a = componentData == null ? void 0 : componentData.parameters) == null ? void 0 : _a[parameterId];
539
539
  }, [componentData, parameterId]);
540
+ const value = useMemo2(() => parameter == null ? void 0 : parameter.value, [parameter]);
540
541
  const isEditable = useMemo2(() => {
541
- var _a, _b, _c;
542
- return (_c = (_b = ((_a = componentData == null ? void 0 : componentData.parameters) == null ? void 0 : _a[parameterId])._contextualEditing) == null ? void 0 : _b.isEditable) != null ? _c : false;
543
- }, [componentData, parameterId]);
542
+ var _a, _b;
543
+ return (_b = (_a = parameter == null ? void 0 : parameter._contextualEditing) == null ? void 0 : _a.isEditable) != null ? _b : false;
544
+ }, [parameter]);
544
545
  const handleOnFocus = useCallback(() => {
545
546
  setIsFocused(true);
546
547
  }, [setIsFocused]);
@@ -548,6 +549,12 @@ var UniformText = ({
548
549
  setIsFocused(false);
549
550
  }, [setIsFocused]);
550
551
  const shouldSkipCustomRendering = useMemo2(() => isFocused && isEditable, [isFocused, isEditable]);
552
+ if (!parameter) {
553
+ console.warn(
554
+ `UniformText: The parameterId "${parameterId}" was not found in the component of type "${componentData == null ? void 0 : componentData.type}"`
555
+ );
556
+ return null;
557
+ }
551
558
  if (!isContextualEditing) {
552
559
  return /* @__PURE__ */ React7.createElement(Tag, { style: isMultiline ? { whiteSpace: "pre-wrap" } : {}, ...props }, render(value));
553
560
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-react",
3
- "version": "18.35.1-alpha.16+3d99d8fd6",
3
+ "version": "18.35.1-alpha.17+c528ec3cb",
4
4
  "description": "React SDK for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -24,9 +24,9 @@
24
24
  "document": "api-extractor run --local"
25
25
  },
26
26
  "dependencies": {
27
- "@uniformdev/canvas": "18.35.1-alpha.16+3d99d8fd6",
28
- "@uniformdev/context": "18.35.1-alpha.16+3d99d8fd6",
29
- "@uniformdev/context-react": "18.35.1-alpha.16+3d99d8fd6"
27
+ "@uniformdev/canvas": "18.35.1-alpha.17+c528ec3cb",
28
+ "@uniformdev/context": "18.35.1-alpha.17+c528ec3cb",
29
+ "@uniformdev/context-react": "18.35.1-alpha.17+c528ec3cb"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": ">= 16 || 17 || 18",
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "3d99d8fd68048310f8f6dc56a1d18e61c35c9765"
46
+ "gitHead": "c528ec3cbb765bfd058357968a9be5ae0926362c"
47
47
  }