@uniformdev/canvas-react 19.58.2-alpha.0 → 19.59.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.mts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.esm.js +27 -7
- package/dist/index.js +32 -16
- package/dist/index.mjs +27 -7
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React$1, { Key, ReactNode, PropsWithChildren } from 'react';
|
|
2
|
-
import * as _uniformdev_canvas from '@uniformdev/canvas';
|
|
3
2
|
import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, getParameterAttributes as getParameterAttributes$1, SubscribeToCompositionOptions } from '@uniformdev/canvas';
|
|
4
3
|
export { GetParameterAttributesProps, createUniformApiEnhancer } from '@uniformdev/canvas';
|
|
5
4
|
import { PureUniformTextProps } from './core.mjs';
|
|
@@ -388,7 +387,18 @@ type UseUniformContextualEditingStateProps = {
|
|
|
388
387
|
*/
|
|
389
388
|
declare const useUniformContextualEditingState: ({ global, }?: UseUniformContextualEditingStateProps) => {
|
|
390
389
|
isContextualEditing: boolean;
|
|
391
|
-
selectedComponentReference:
|
|
390
|
+
selectedComponentReference: {
|
|
391
|
+
id: string;
|
|
392
|
+
slotName?: string | undefined;
|
|
393
|
+
componentIndex?: number | undefined;
|
|
394
|
+
totalComponents?: number | undefined;
|
|
395
|
+
componentName?: string | undefined;
|
|
396
|
+
componentTitle?: string | undefined;
|
|
397
|
+
parentId?: string | undefined;
|
|
398
|
+
parentType?: string | undefined;
|
|
399
|
+
isLocalized?: boolean | undefined;
|
|
400
|
+
isReadOnly?: boolean | undefined;
|
|
401
|
+
} | undefined;
|
|
392
402
|
};
|
|
393
403
|
|
|
394
404
|
declare const componentStore: ComponentStore;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React$1, { Key, ReactNode, PropsWithChildren } from 'react';
|
|
2
|
-
import * as _uniformdev_canvas from '@uniformdev/canvas';
|
|
3
2
|
import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, getParameterAttributes as getParameterAttributes$1, SubscribeToCompositionOptions } from '@uniformdev/canvas';
|
|
4
3
|
export { GetParameterAttributesProps, createUniformApiEnhancer } from '@uniformdev/canvas';
|
|
5
4
|
import { PureUniformTextProps } from './core.js';
|
|
@@ -388,7 +387,18 @@ type UseUniformContextualEditingStateProps = {
|
|
|
388
387
|
*/
|
|
389
388
|
declare const useUniformContextualEditingState: ({ global, }?: UseUniformContextualEditingStateProps) => {
|
|
390
389
|
isContextualEditing: boolean;
|
|
391
|
-
selectedComponentReference:
|
|
390
|
+
selectedComponentReference: {
|
|
391
|
+
id: string;
|
|
392
|
+
slotName?: string | undefined;
|
|
393
|
+
componentIndex?: number | undefined;
|
|
394
|
+
totalComponents?: number | undefined;
|
|
395
|
+
componentName?: string | undefined;
|
|
396
|
+
componentTitle?: string | undefined;
|
|
397
|
+
parentId?: string | undefined;
|
|
398
|
+
parentType?: string | undefined;
|
|
399
|
+
isLocalized?: boolean | undefined;
|
|
400
|
+
isReadOnly?: boolean | undefined;
|
|
401
|
+
} | undefined;
|
|
392
402
|
};
|
|
393
403
|
|
|
394
404
|
declare const componentStore: ComponentStore;
|
package/dist/index.esm.js
CHANGED
|
@@ -253,7 +253,7 @@ var useUniformContextualEditing = ({
|
|
|
253
253
|
window.__UNIFORM_CONTEXTUAL_EDITING__ = {
|
|
254
254
|
framework: "React",
|
|
255
255
|
// Make sure to also update the value in canvas-vue
|
|
256
|
-
version:
|
|
256
|
+
version: 2
|
|
257
257
|
};
|
|
258
258
|
const script = document.createElement("script");
|
|
259
259
|
script.id = IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID;
|
|
@@ -607,6 +607,11 @@ var UniformPlayground = ({
|
|
|
607
607
|
};
|
|
608
608
|
|
|
609
609
|
// src/components/UniformRichText/UniformRichText.tsx
|
|
610
|
+
import {
|
|
611
|
+
ATTRIBUTE_COMPONENT_ID,
|
|
612
|
+
ATTRIBUTE_PARAMETER_ID,
|
|
613
|
+
ATTRIBUTE_PARAMETER_TYPE
|
|
614
|
+
} from "@uniformdev/canvas";
|
|
610
615
|
import {
|
|
611
616
|
isRichTextValue,
|
|
612
617
|
isRichTextValueConsideredEmpty
|
|
@@ -729,7 +734,19 @@ var UniformRichText = React17.forwardRef(function UniformRichText2({ parameterId
|
|
|
729
734
|
const value = useMemo3(() => parameter == null ? void 0 : parameter.value, [parameter]);
|
|
730
735
|
if (!value || !isRichTextValue(value) || isRichTextValueConsideredEmpty(value))
|
|
731
736
|
return null;
|
|
732
|
-
return Tag === null ? /* @__PURE__ */ React17.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer }) : /* @__PURE__ */ React17.createElement(
|
|
737
|
+
return Tag === null ? /* @__PURE__ */ React17.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer }) : /* @__PURE__ */ React17.createElement(
|
|
738
|
+
Tag,
|
|
739
|
+
{
|
|
740
|
+
ref,
|
|
741
|
+
...props,
|
|
742
|
+
...{
|
|
743
|
+
[ATTRIBUTE_COMPONENT_ID]: componentData == null ? void 0 : componentData._id,
|
|
744
|
+
[ATTRIBUTE_PARAMETER_ID]: parameterId,
|
|
745
|
+
[ATTRIBUTE_PARAMETER_TYPE]: "richText"
|
|
746
|
+
}
|
|
747
|
+
},
|
|
748
|
+
/* @__PURE__ */ React17.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer })
|
|
749
|
+
);
|
|
733
750
|
});
|
|
734
751
|
|
|
735
752
|
// src/components/UniformText.tsx
|
|
@@ -909,11 +926,14 @@ var useUniformContextualEditingState = ({
|
|
|
909
926
|
return () => {
|
|
910
927
|
unsubscribe();
|
|
911
928
|
};
|
|
912
|
-
}, [global, channel, componentData == null ? void 0 : componentData._id]);
|
|
913
|
-
return
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
929
|
+
}, [global, channel, componentData == null ? void 0 : componentData._id, setSelectedComponentReference]);
|
|
930
|
+
return useMemo4(
|
|
931
|
+
() => ({
|
|
932
|
+
isContextualEditing,
|
|
933
|
+
selectedComponentReference
|
|
934
|
+
}),
|
|
935
|
+
[isContextualEditing, selectedComponentReference]
|
|
936
|
+
);
|
|
917
937
|
};
|
|
918
938
|
export {
|
|
919
939
|
DefaultNotImplementedComponent,
|
package/dist/index.js
CHANGED
|
@@ -287,7 +287,7 @@ var useUniformContextualEditing = ({
|
|
|
287
287
|
window.__UNIFORM_CONTEXTUAL_EDITING__ = {
|
|
288
288
|
framework: "React",
|
|
289
289
|
// Make sure to also update the value in canvas-vue
|
|
290
|
-
version:
|
|
290
|
+
version: 2
|
|
291
291
|
};
|
|
292
292
|
const script = document.createElement("script");
|
|
293
293
|
script.id = import_canvas3.IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID;
|
|
@@ -641,6 +641,7 @@ var UniformPlayground = ({
|
|
|
641
641
|
};
|
|
642
642
|
|
|
643
643
|
// src/components/UniformRichText/UniformRichText.tsx
|
|
644
|
+
var import_canvas8 = require("@uniformdev/canvas");
|
|
644
645
|
var import_richtext5 = require("@uniformdev/richtext");
|
|
645
646
|
var import_react17 = __toESM(require("react"));
|
|
646
647
|
|
|
@@ -760,7 +761,19 @@ var UniformRichText = import_react17.default.forwardRef(function UniformRichText
|
|
|
760
761
|
const value = (0, import_react17.useMemo)(() => parameter == null ? void 0 : parameter.value, [parameter]);
|
|
761
762
|
if (!value || !(0, import_richtext5.isRichTextValue)(value) || (0, import_richtext5.isRichTextValueConsideredEmpty)(value))
|
|
762
763
|
return null;
|
|
763
|
-
return Tag === null ? /* @__PURE__ */ import_react17.default.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer }) : /* @__PURE__ */ import_react17.default.createElement(
|
|
764
|
+
return Tag === null ? /* @__PURE__ */ import_react17.default.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer }) : /* @__PURE__ */ import_react17.default.createElement(
|
|
765
|
+
Tag,
|
|
766
|
+
{
|
|
767
|
+
ref,
|
|
768
|
+
...props,
|
|
769
|
+
...{
|
|
770
|
+
[import_canvas8.ATTRIBUTE_COMPONENT_ID]: componentData == null ? void 0 : componentData._id,
|
|
771
|
+
[import_canvas8.ATTRIBUTE_PARAMETER_ID]: parameterId,
|
|
772
|
+
[import_canvas8.ATTRIBUTE_PARAMETER_TYPE]: "richText"
|
|
773
|
+
}
|
|
774
|
+
},
|
|
775
|
+
/* @__PURE__ */ import_react17.default.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer })
|
|
776
|
+
);
|
|
764
777
|
});
|
|
765
778
|
|
|
766
779
|
// src/components/UniformText.tsx
|
|
@@ -850,16 +863,16 @@ var UniformText = ({
|
|
|
850
863
|
};
|
|
851
864
|
|
|
852
865
|
// src/helpers/getParameterAttributes.ts
|
|
853
|
-
var
|
|
866
|
+
var import_canvas9 = require("@uniformdev/canvas");
|
|
854
867
|
var getParameterAttributes = (options) => {
|
|
855
868
|
return {
|
|
856
|
-
...(0,
|
|
869
|
+
...(0, import_canvas9.getParameterAttributes)(options),
|
|
857
870
|
suppressContentEditableWarning: true
|
|
858
871
|
};
|
|
859
872
|
};
|
|
860
873
|
|
|
861
874
|
// src/hooks/useCompositionEventEffect.ts
|
|
862
|
-
var
|
|
875
|
+
var import_canvas10 = require("@uniformdev/canvas");
|
|
863
876
|
var import_react20 = require("react");
|
|
864
877
|
function useCompositionEventEffect({
|
|
865
878
|
enabled,
|
|
@@ -873,12 +886,12 @@ function useCompositionEventEffect({
|
|
|
873
886
|
}
|
|
874
887
|
let goodbye = void 0;
|
|
875
888
|
const loadEffect = async () => {
|
|
876
|
-
const eventBus = await (0,
|
|
889
|
+
const eventBus = await (0, import_canvas10.createEventBus)();
|
|
877
890
|
if (eventBus) {
|
|
878
|
-
goodbye = (0,
|
|
891
|
+
goodbye = (0, import_canvas10.subscribeToComposition)({
|
|
879
892
|
eventBus,
|
|
880
893
|
compositionId,
|
|
881
|
-
compositionState:
|
|
894
|
+
compositionState: import_canvas10.CANVAS_DRAFT_STATE,
|
|
882
895
|
projectId,
|
|
883
896
|
callback: effect,
|
|
884
897
|
event: "updated"
|
|
@@ -895,7 +908,7 @@ function useCompositionEventEffect({
|
|
|
895
908
|
}
|
|
896
909
|
|
|
897
910
|
// src/hooks/useUniformContextualEditingState.ts
|
|
898
|
-
var
|
|
911
|
+
var import_canvas11 = require("@uniformdev/canvas");
|
|
899
912
|
var import_react21 = require("react");
|
|
900
913
|
var useUniformContextualEditingState = ({
|
|
901
914
|
global = false
|
|
@@ -907,7 +920,7 @@ var useUniformContextualEditingState = ({
|
|
|
907
920
|
if (!isContextualEditing) {
|
|
908
921
|
return;
|
|
909
922
|
}
|
|
910
|
-
const channel2 = (0,
|
|
923
|
+
const channel2 = (0, import_canvas11.createCanvasChannel)({
|
|
911
924
|
broadcastTo: [window],
|
|
912
925
|
listenTo: [window]
|
|
913
926
|
});
|
|
@@ -919,7 +932,7 @@ var useUniformContextualEditingState = ({
|
|
|
919
932
|
}
|
|
920
933
|
const unsubscribe = channel.on("update-contextual-editing-state-internal", async (message) => {
|
|
921
934
|
var _a;
|
|
922
|
-
if (!(0,
|
|
935
|
+
if (!(0, import_canvas11.isUpdateContextualEditingStateInternalMessage)(message)) {
|
|
923
936
|
return;
|
|
924
937
|
}
|
|
925
938
|
if (!global && (componentData == null ? void 0 : componentData._id) !== ((_a = message.state.selectedComponentReference) == null ? void 0 : _a.parentId)) {
|
|
@@ -931,11 +944,14 @@ var useUniformContextualEditingState = ({
|
|
|
931
944
|
return () => {
|
|
932
945
|
unsubscribe();
|
|
933
946
|
};
|
|
934
|
-
}, [global, channel, componentData == null ? void 0 : componentData._id]);
|
|
935
|
-
return
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
947
|
+
}, [global, channel, componentData == null ? void 0 : componentData._id, setSelectedComponentReference]);
|
|
948
|
+
return (0, import_react21.useMemo)(
|
|
949
|
+
() => ({
|
|
950
|
+
isContextualEditing,
|
|
951
|
+
selectedComponentReference
|
|
952
|
+
}),
|
|
953
|
+
[isContextualEditing, selectedComponentReference]
|
|
954
|
+
);
|
|
939
955
|
};
|
|
940
956
|
// Annotate the CommonJS export names for ESM import in node:
|
|
941
957
|
0 && (module.exports = {
|
package/dist/index.mjs
CHANGED
|
@@ -253,7 +253,7 @@ var useUniformContextualEditing = ({
|
|
|
253
253
|
window.__UNIFORM_CONTEXTUAL_EDITING__ = {
|
|
254
254
|
framework: "React",
|
|
255
255
|
// Make sure to also update the value in canvas-vue
|
|
256
|
-
version:
|
|
256
|
+
version: 2
|
|
257
257
|
};
|
|
258
258
|
const script = document.createElement("script");
|
|
259
259
|
script.id = IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID;
|
|
@@ -607,6 +607,11 @@ var UniformPlayground = ({
|
|
|
607
607
|
};
|
|
608
608
|
|
|
609
609
|
// src/components/UniformRichText/UniformRichText.tsx
|
|
610
|
+
import {
|
|
611
|
+
ATTRIBUTE_COMPONENT_ID,
|
|
612
|
+
ATTRIBUTE_PARAMETER_ID,
|
|
613
|
+
ATTRIBUTE_PARAMETER_TYPE
|
|
614
|
+
} from "@uniformdev/canvas";
|
|
610
615
|
import {
|
|
611
616
|
isRichTextValue,
|
|
612
617
|
isRichTextValueConsideredEmpty
|
|
@@ -729,7 +734,19 @@ var UniformRichText = React17.forwardRef(function UniformRichText2({ parameterId
|
|
|
729
734
|
const value = useMemo3(() => parameter == null ? void 0 : parameter.value, [parameter]);
|
|
730
735
|
if (!value || !isRichTextValue(value) || isRichTextValueConsideredEmpty(value))
|
|
731
736
|
return null;
|
|
732
|
-
return Tag === null ? /* @__PURE__ */ React17.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer }) : /* @__PURE__ */ React17.createElement(
|
|
737
|
+
return Tag === null ? /* @__PURE__ */ React17.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer }) : /* @__PURE__ */ React17.createElement(
|
|
738
|
+
Tag,
|
|
739
|
+
{
|
|
740
|
+
ref,
|
|
741
|
+
...props,
|
|
742
|
+
...{
|
|
743
|
+
[ATTRIBUTE_COMPONENT_ID]: componentData == null ? void 0 : componentData._id,
|
|
744
|
+
[ATTRIBUTE_PARAMETER_ID]: parameterId,
|
|
745
|
+
[ATTRIBUTE_PARAMETER_TYPE]: "richText"
|
|
746
|
+
}
|
|
747
|
+
},
|
|
748
|
+
/* @__PURE__ */ React17.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer })
|
|
749
|
+
);
|
|
733
750
|
});
|
|
734
751
|
|
|
735
752
|
// src/components/UniformText.tsx
|
|
@@ -909,11 +926,14 @@ var useUniformContextualEditingState = ({
|
|
|
909
926
|
return () => {
|
|
910
927
|
unsubscribe();
|
|
911
928
|
};
|
|
912
|
-
}, [global, channel, componentData == null ? void 0 : componentData._id]);
|
|
913
|
-
return
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
929
|
+
}, [global, channel, componentData == null ? void 0 : componentData._id, setSelectedComponentReference]);
|
|
930
|
+
return useMemo4(
|
|
931
|
+
() => ({
|
|
932
|
+
isContextualEditing,
|
|
933
|
+
selectedComponentReference
|
|
934
|
+
}),
|
|
935
|
+
[isContextualEditing, selectedComponentReference]
|
|
936
|
+
);
|
|
917
937
|
};
|
|
918
938
|
export {
|
|
919
939
|
DefaultNotImplementedComponent,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-react",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.59.0",
|
|
4
4
|
"description": "React SDK for Uniform Canvas",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"document": "api-extractor run --local"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@uniformdev/canvas": "19.
|
|
49
|
-
"@uniformdev/context": "19.
|
|
50
|
-
"@uniformdev/context-react": "19.
|
|
51
|
-
"@uniformdev/richtext": "19.
|
|
48
|
+
"@uniformdev/canvas": "19.59.0",
|
|
49
|
+
"@uniformdev/context": "19.59.0",
|
|
50
|
+
"@uniformdev/context-react": "19.59.0",
|
|
51
|
+
"@uniformdev/richtext": "19.59.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"react": ">= 16 || 17 || 18",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "912b2badf364d2959cb0b664ba16d9741f16add5"
|
|
69
69
|
}
|