@uniformdev/canvas-react 19.58.1 → 19.58.2-alpha.11
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 +21 -3
- package/dist/index.d.ts +21 -3
- package/dist/index.esm.js +29 -8
- package/dist/index.js +35 -17
- package/dist/index.mjs +29 -8
- 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';
|
|
@@ -352,6 +351,14 @@ type UniformSlotProps<TSlotNames extends string> = {
|
|
|
352
351
|
/** Renders a named Slot within a Composition. */
|
|
353
352
|
declare function UniformSlot<TSlotNames extends string = string>({ name, resolveRenderer, children, emptyPlaceholder, wrapperComponent, }: UniformSlotProps<TSlotNames>): JSX.Element | null;
|
|
354
353
|
|
|
354
|
+
/**
|
|
355
|
+
* Converts a raw Canvas component instance to React component props format.
|
|
356
|
+
* This merges each parameter moved to the root object and removes the 'value' node,
|
|
357
|
+
* hugely simplifying rendering code. For example if the raw object has parameters.foo.value,
|
|
358
|
+
* then the final props have props.foo === raw.parameters.foo.value.
|
|
359
|
+
*/
|
|
360
|
+
declare function convertComponentToProps<T = unknown>(component: ComponentInstance): ComponentProps<T>;
|
|
361
|
+
|
|
355
362
|
/**
|
|
356
363
|
* Returns the attributes needed to annotate a Uniform parameter for inline editing.
|
|
357
364
|
* Supports only text parameters at the moment.
|
|
@@ -380,7 +387,18 @@ type UseUniformContextualEditingStateProps = {
|
|
|
380
387
|
*/
|
|
381
388
|
declare const useUniformContextualEditingState: ({ global, }?: UseUniformContextualEditingStateProps) => {
|
|
382
389
|
isContextualEditing: boolean;
|
|
383
|
-
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;
|
|
384
402
|
};
|
|
385
403
|
|
|
386
404
|
declare const componentStore: ComponentStore;
|
|
@@ -399,4 +417,4 @@ declare const createComponentStoreResolver: (options: {
|
|
|
399
417
|
defaultComponent?: React$1.ComponentType<ComponentProps<any>>;
|
|
400
418
|
}) => RenderComponentResolver;
|
|
401
419
|
|
|
402
|
-
export { ComponentProps, ComponentStore, CustomSlotChildRenderFunc, DefaultNotImplementedComponent, NOT_IMPLEMENTED_COMPONENT, RenderComponentResolver, RenderRichTextComponentResolver, RichTextComponentProps, RichTextRendererComponent, SystemRenderConfig, SystemRenderFunction, UniformComponent, UniformComponentContextValue, UniformComponentProps, UniformComposition, UniformCompositionContext, UniformCompositionProps, UniformPlayground, UniformPlaygroundDecorator, UniformPlaygroundProps, UniformRichText, UniformRichTextNode, UniformRichTextNodeProps, UniformRichTextProps, UniformSlot, UniformSlotProps, UniformSlotWrapperComponentProps, UniformText, UniformTextProps, UseCompositionEventEffectOptions, UseUniformContextualEditingProps, UseUniformContextualEditingStateProps, componentStore, componentStoreResolver, createComponentStore, createComponentStoreResolver, getParameterAttributes, registerUniformComponent, useCompositionEventEffect, useUniformContextualEditing, useUniformContextualEditingState, useUniformCurrentComponent, useUniformCurrentComposition };
|
|
420
|
+
export { ComponentProps, ComponentStore, CustomSlotChildRenderFunc, DefaultNotImplementedComponent, NOT_IMPLEMENTED_COMPONENT, RenderComponentResolver, RenderRichTextComponentResolver, RichTextComponentProps, RichTextRendererComponent, SystemRenderConfig, SystemRenderFunction, UniformComponent, UniformComponentContextValue, UniformComponentProps, UniformComposition, UniformCompositionContext, UniformCompositionProps, UniformPlayground, UniformPlaygroundDecorator, UniformPlaygroundProps, UniformRichText, UniformRichTextNode, UniformRichTextNodeProps, UniformRichTextProps, UniformSlot, UniformSlotProps, UniformSlotWrapperComponentProps, UniformText, UniformTextProps, UseCompositionEventEffectOptions, UseUniformContextualEditingProps, UseUniformContextualEditingStateProps, componentStore, componentStoreResolver, convertComponentToProps, createComponentStore, createComponentStoreResolver, getParameterAttributes, registerUniformComponent, useCompositionEventEffect, useUniformContextualEditing, useUniformContextualEditingState, useUniformCurrentComponent, useUniformCurrentComposition };
|
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';
|
|
@@ -352,6 +351,14 @@ type UniformSlotProps<TSlotNames extends string> = {
|
|
|
352
351
|
/** Renders a named Slot within a Composition. */
|
|
353
352
|
declare function UniformSlot<TSlotNames extends string = string>({ name, resolveRenderer, children, emptyPlaceholder, wrapperComponent, }: UniformSlotProps<TSlotNames>): JSX.Element | null;
|
|
354
353
|
|
|
354
|
+
/**
|
|
355
|
+
* Converts a raw Canvas component instance to React component props format.
|
|
356
|
+
* This merges each parameter moved to the root object and removes the 'value' node,
|
|
357
|
+
* hugely simplifying rendering code. For example if the raw object has parameters.foo.value,
|
|
358
|
+
* then the final props have props.foo === raw.parameters.foo.value.
|
|
359
|
+
*/
|
|
360
|
+
declare function convertComponentToProps<T = unknown>(component: ComponentInstance): ComponentProps<T>;
|
|
361
|
+
|
|
355
362
|
/**
|
|
356
363
|
* Returns the attributes needed to annotate a Uniform parameter for inline editing.
|
|
357
364
|
* Supports only text parameters at the moment.
|
|
@@ -380,7 +387,18 @@ type UseUniformContextualEditingStateProps = {
|
|
|
380
387
|
*/
|
|
381
388
|
declare const useUniformContextualEditingState: ({ global, }?: UseUniformContextualEditingStateProps) => {
|
|
382
389
|
isContextualEditing: boolean;
|
|
383
|
-
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;
|
|
384
402
|
};
|
|
385
403
|
|
|
386
404
|
declare const componentStore: ComponentStore;
|
|
@@ -399,4 +417,4 @@ declare const createComponentStoreResolver: (options: {
|
|
|
399
417
|
defaultComponent?: React$1.ComponentType<ComponentProps<any>>;
|
|
400
418
|
}) => RenderComponentResolver;
|
|
401
419
|
|
|
402
|
-
export { ComponentProps, ComponentStore, CustomSlotChildRenderFunc, DefaultNotImplementedComponent, NOT_IMPLEMENTED_COMPONENT, RenderComponentResolver, RenderRichTextComponentResolver, RichTextComponentProps, RichTextRendererComponent, SystemRenderConfig, SystemRenderFunction, UniformComponent, UniformComponentContextValue, UniformComponentProps, UniformComposition, UniformCompositionContext, UniformCompositionProps, UniformPlayground, UniformPlaygroundDecorator, UniformPlaygroundProps, UniformRichText, UniformRichTextNode, UniformRichTextNodeProps, UniformRichTextProps, UniformSlot, UniformSlotProps, UniformSlotWrapperComponentProps, UniformText, UniformTextProps, UseCompositionEventEffectOptions, UseUniformContextualEditingProps, UseUniformContextualEditingStateProps, componentStore, componentStoreResolver, createComponentStore, createComponentStoreResolver, getParameterAttributes, registerUniformComponent, useCompositionEventEffect, useUniformContextualEditing, useUniformContextualEditingState, useUniformCurrentComponent, useUniformCurrentComposition };
|
|
420
|
+
export { ComponentProps, ComponentStore, CustomSlotChildRenderFunc, DefaultNotImplementedComponent, NOT_IMPLEMENTED_COMPONENT, RenderComponentResolver, RenderRichTextComponentResolver, RichTextComponentProps, RichTextRendererComponent, SystemRenderConfig, SystemRenderFunction, UniformComponent, UniformComponentContextValue, UniformComponentProps, UniformComposition, UniformCompositionContext, UniformCompositionProps, UniformPlayground, UniformPlaygroundDecorator, UniformPlaygroundProps, UniformRichText, UniformRichTextNode, UniformRichTextNodeProps, UniformRichTextProps, UniformSlot, UniformSlotProps, UniformSlotWrapperComponentProps, UniformText, UniformTextProps, UseCompositionEventEffectOptions, UseUniformContextualEditingProps, UseUniformContextualEditingStateProps, componentStore, componentStoreResolver, convertComponentToProps, createComponentStore, createComponentStoreResolver, getParameterAttributes, registerUniformComponent, useCompositionEventEffect, useUniformContextualEditing, useUniformContextualEditingState, useUniformCurrentComponent, useUniformCurrentComposition };
|
package/dist/index.esm.js
CHANGED
|
@@ -75,7 +75,7 @@ import {
|
|
|
75
75
|
import { Track, TrackFragment, useUniformContext } from "@uniformdev/context-react";
|
|
76
76
|
import React6, { createContext as createContext2, useContext as useContext2 } from "react";
|
|
77
77
|
|
|
78
|
-
// src/convertComponentToProps.ts
|
|
78
|
+
// src/helpers/convertComponentToProps.ts
|
|
79
79
|
function convertComponentToProps(component) {
|
|
80
80
|
var _a;
|
|
81
81
|
const parameters = (_a = component.parameters) != null ? _a : {};
|
|
@@ -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,
|
|
@@ -928,6 +948,7 @@ export {
|
|
|
928
948
|
UniformText,
|
|
929
949
|
componentStore,
|
|
930
950
|
componentStoreResolver,
|
|
951
|
+
convertComponentToProps,
|
|
931
952
|
createComponentStore,
|
|
932
953
|
createComponentStoreResolver,
|
|
933
954
|
createUniformApiEnhancer,
|
package/dist/index.js
CHANGED
|
@@ -42,6 +42,7 @@ __export(src_exports, {
|
|
|
42
42
|
UniformText: () => UniformText,
|
|
43
43
|
componentStore: () => componentStore,
|
|
44
44
|
componentStoreResolver: () => componentStoreResolver,
|
|
45
|
+
convertComponentToProps: () => convertComponentToProps,
|
|
45
46
|
createComponentStore: () => createComponentStore,
|
|
46
47
|
createComponentStoreResolver: () => createComponentStoreResolver,
|
|
47
48
|
createUniformApiEnhancer: () => import_canvas3.createUniformApiEnhancer,
|
|
@@ -130,7 +131,7 @@ var import_canvas6 = require("@uniformdev/canvas");
|
|
|
130
131
|
var import_context_react2 = require("@uniformdev/context-react");
|
|
131
132
|
var import_react6 = __toESM(require("react"));
|
|
132
133
|
|
|
133
|
-
// src/convertComponentToProps.ts
|
|
134
|
+
// src/helpers/convertComponentToProps.ts
|
|
134
135
|
function convertComponentToProps(component) {
|
|
135
136
|
var _a;
|
|
136
137
|
const parameters = (_a = component.parameters) != null ? _a : {};
|
|
@@ -286,7 +287,7 @@ var useUniformContextualEditing = ({
|
|
|
286
287
|
window.__UNIFORM_CONTEXTUAL_EDITING__ = {
|
|
287
288
|
framework: "React",
|
|
288
289
|
// Make sure to also update the value in canvas-vue
|
|
289
|
-
version:
|
|
290
|
+
version: 2
|
|
290
291
|
};
|
|
291
292
|
const script = document.createElement("script");
|
|
292
293
|
script.id = import_canvas3.IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID;
|
|
@@ -640,6 +641,7 @@ var UniformPlayground = ({
|
|
|
640
641
|
};
|
|
641
642
|
|
|
642
643
|
// src/components/UniformRichText/UniformRichText.tsx
|
|
644
|
+
var import_canvas8 = require("@uniformdev/canvas");
|
|
643
645
|
var import_richtext5 = require("@uniformdev/richtext");
|
|
644
646
|
var import_react17 = __toESM(require("react"));
|
|
645
647
|
|
|
@@ -759,7 +761,19 @@ var UniformRichText = import_react17.default.forwardRef(function UniformRichText
|
|
|
759
761
|
const value = (0, import_react17.useMemo)(() => parameter == null ? void 0 : parameter.value, [parameter]);
|
|
760
762
|
if (!value || !(0, import_richtext5.isRichTextValue)(value) || (0, import_richtext5.isRichTextValueConsideredEmpty)(value))
|
|
761
763
|
return null;
|
|
762
|
-
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
|
+
);
|
|
763
777
|
});
|
|
764
778
|
|
|
765
779
|
// src/components/UniformText.tsx
|
|
@@ -849,16 +863,16 @@ var UniformText = ({
|
|
|
849
863
|
};
|
|
850
864
|
|
|
851
865
|
// src/helpers/getParameterAttributes.ts
|
|
852
|
-
var
|
|
866
|
+
var import_canvas9 = require("@uniformdev/canvas");
|
|
853
867
|
var getParameterAttributes = (options) => {
|
|
854
868
|
return {
|
|
855
|
-
...(0,
|
|
869
|
+
...(0, import_canvas9.getParameterAttributes)(options),
|
|
856
870
|
suppressContentEditableWarning: true
|
|
857
871
|
};
|
|
858
872
|
};
|
|
859
873
|
|
|
860
874
|
// src/hooks/useCompositionEventEffect.ts
|
|
861
|
-
var
|
|
875
|
+
var import_canvas10 = require("@uniformdev/canvas");
|
|
862
876
|
var import_react20 = require("react");
|
|
863
877
|
function useCompositionEventEffect({
|
|
864
878
|
enabled,
|
|
@@ -872,12 +886,12 @@ function useCompositionEventEffect({
|
|
|
872
886
|
}
|
|
873
887
|
let goodbye = void 0;
|
|
874
888
|
const loadEffect = async () => {
|
|
875
|
-
const eventBus = await (0,
|
|
889
|
+
const eventBus = await (0, import_canvas10.createEventBus)();
|
|
876
890
|
if (eventBus) {
|
|
877
|
-
goodbye = (0,
|
|
891
|
+
goodbye = (0, import_canvas10.subscribeToComposition)({
|
|
878
892
|
eventBus,
|
|
879
893
|
compositionId,
|
|
880
|
-
compositionState:
|
|
894
|
+
compositionState: import_canvas10.CANVAS_DRAFT_STATE,
|
|
881
895
|
projectId,
|
|
882
896
|
callback: effect,
|
|
883
897
|
event: "updated"
|
|
@@ -894,7 +908,7 @@ function useCompositionEventEffect({
|
|
|
894
908
|
}
|
|
895
909
|
|
|
896
910
|
// src/hooks/useUniformContextualEditingState.ts
|
|
897
|
-
var
|
|
911
|
+
var import_canvas11 = require("@uniformdev/canvas");
|
|
898
912
|
var import_react21 = require("react");
|
|
899
913
|
var useUniformContextualEditingState = ({
|
|
900
914
|
global = false
|
|
@@ -906,7 +920,7 @@ var useUniformContextualEditingState = ({
|
|
|
906
920
|
if (!isContextualEditing) {
|
|
907
921
|
return;
|
|
908
922
|
}
|
|
909
|
-
const channel2 = (0,
|
|
923
|
+
const channel2 = (0, import_canvas11.createCanvasChannel)({
|
|
910
924
|
broadcastTo: [window],
|
|
911
925
|
listenTo: [window]
|
|
912
926
|
});
|
|
@@ -918,7 +932,7 @@ var useUniformContextualEditingState = ({
|
|
|
918
932
|
}
|
|
919
933
|
const unsubscribe = channel.on("update-contextual-editing-state-internal", async (message) => {
|
|
920
934
|
var _a;
|
|
921
|
-
if (!(0,
|
|
935
|
+
if (!(0, import_canvas11.isUpdateContextualEditingStateInternalMessage)(message)) {
|
|
922
936
|
return;
|
|
923
937
|
}
|
|
924
938
|
if (!global && (componentData == null ? void 0 : componentData._id) !== ((_a = message.state.selectedComponentReference) == null ? void 0 : _a.parentId)) {
|
|
@@ -930,11 +944,14 @@ var useUniformContextualEditingState = ({
|
|
|
930
944
|
return () => {
|
|
931
945
|
unsubscribe();
|
|
932
946
|
};
|
|
933
|
-
}, [global, channel, componentData == null ? void 0 : componentData._id]);
|
|
934
|
-
return
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
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
|
+
);
|
|
938
955
|
};
|
|
939
956
|
// Annotate the CommonJS export names for ESM import in node:
|
|
940
957
|
0 && (module.exports = {
|
|
@@ -950,6 +967,7 @@ var useUniformContextualEditingState = ({
|
|
|
950
967
|
UniformText,
|
|
951
968
|
componentStore,
|
|
952
969
|
componentStoreResolver,
|
|
970
|
+
convertComponentToProps,
|
|
953
971
|
createComponentStore,
|
|
954
972
|
createComponentStoreResolver,
|
|
955
973
|
createUniformApiEnhancer,
|
package/dist/index.mjs
CHANGED
|
@@ -75,7 +75,7 @@ import {
|
|
|
75
75
|
import { Track, TrackFragment, useUniformContext } from "@uniformdev/context-react";
|
|
76
76
|
import React6, { createContext as createContext2, useContext as useContext2 } from "react";
|
|
77
77
|
|
|
78
|
-
// src/convertComponentToProps.ts
|
|
78
|
+
// src/helpers/convertComponentToProps.ts
|
|
79
79
|
function convertComponentToProps(component) {
|
|
80
80
|
var _a;
|
|
81
81
|
const parameters = (_a = component.parameters) != null ? _a : {};
|
|
@@ -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,
|
|
@@ -928,6 +948,7 @@ export {
|
|
|
928
948
|
UniformText,
|
|
929
949
|
componentStore,
|
|
930
950
|
componentStoreResolver,
|
|
951
|
+
convertComponentToProps,
|
|
931
952
|
createComponentStore,
|
|
932
953
|
createComponentStoreResolver,
|
|
933
954
|
createUniformApiEnhancer,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-react",
|
|
3
|
-
"version": "19.58.
|
|
3
|
+
"version": "19.58.2-alpha.11+9a1da0c41",
|
|
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.58.
|
|
49
|
-
"@uniformdev/context": "19.58.
|
|
50
|
-
"@uniformdev/context-react": "19.58.
|
|
51
|
-
"@uniformdev/richtext": "19.58.
|
|
48
|
+
"@uniformdev/canvas": "19.58.2-alpha.11+9a1da0c41",
|
|
49
|
+
"@uniformdev/context": "19.58.2-alpha.11+9a1da0c41",
|
|
50
|
+
"@uniformdev/context-react": "19.58.2-alpha.11+9a1da0c41",
|
|
51
|
+
"@uniformdev/richtext": "19.58.2-alpha.11+9a1da0c41"
|
|
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": "9a1da0c4162d8d70477d87a876eeaaf4525d94ac"
|
|
69
69
|
}
|