@uniformdev/canvas-react 19.214.0 → 19.214.1-alpha.10
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 +3 -18
- package/dist/index.d.ts +3 -18
- package/dist/index.esm.js +3 -46
- package/dist/index.js +9 -49
- package/dist/index.mjs +3 -46
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React$1, { Key, ReactNode, PropsWithChildren } from 'react';
|
|
2
|
-
import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, getParameterAttributes as getParameterAttributes$1,
|
|
2
|
+
import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, getParameterAttributes as getParameterAttributes$1, UpdateContextualEditingStateInternalMessage } from '@uniformdev/canvas';
|
|
3
3
|
export { GetParameterAttributesProps, createUniformApiEnhancer } from '@uniformdev/canvas';
|
|
4
4
|
import { P as PureUniformTextProps } from './PureUniformText-B3GAm6Dc.mjs';
|
|
5
5
|
import { RichTextNode } from '@uniformdev/richtext';
|
|
@@ -460,8 +460,6 @@ type UniformPlaygroundProps = {
|
|
|
460
460
|
* @deprecated This feature is not stable yet and might be changed or removed in a minor release. Do not use it in production environments.
|
|
461
461
|
*/
|
|
462
462
|
decorators?: UniformPlaygroundDecorator[];
|
|
463
|
-
/** @deprecated This prop is not supported anymore. */
|
|
464
|
-
children?: ReactNode;
|
|
465
463
|
} & Omit<UniformCompositionProps, 'data' | 'children'>;
|
|
466
464
|
/**
|
|
467
465
|
* Playground where you can freely live preview your components and patterns.
|
|
@@ -552,12 +550,6 @@ type UniformSlotProps<TSlotNames extends string> = {
|
|
|
552
550
|
* If not specified, the resolveRenderer function on the nearest Layout will be used, if any.
|
|
553
551
|
*/
|
|
554
552
|
resolveRenderer?: RenderComponentResolver;
|
|
555
|
-
/**
|
|
556
|
-
* Optional render props enables wrapping all child components in the slot with some markup
|
|
557
|
-
*
|
|
558
|
-
* @deprecated Use `wrapperComponent` instead and define wrapping component for slot children inside.
|
|
559
|
-
*/
|
|
560
|
-
children?: CustomSlotChildRenderFunc;
|
|
561
553
|
/**
|
|
562
554
|
* Optional wrapper component around list of slot items that allows to control
|
|
563
555
|
* exactly how to render slot items, otherwise React.Fragment is being used
|
|
@@ -571,7 +563,7 @@ type UniformSlotProps<TSlotNames extends string> = {
|
|
|
571
563
|
emptyPlaceholder?: React$1.ReactNode;
|
|
572
564
|
};
|
|
573
565
|
/** Renders a named Slot within a Composition. */
|
|
574
|
-
declare function UniformSlot<TSlotNames extends string = string>({ name, resolveRenderer,
|
|
566
|
+
declare function UniformSlot<TSlotNames extends string = string>({ name, resolveRenderer, emptyPlaceholder, wrapperComponent, }: UniformSlotProps<TSlotNames>): JSX.Element | null;
|
|
575
567
|
|
|
576
568
|
/**
|
|
577
569
|
* Converts a raw Canvas component instance to React component props format.
|
|
@@ -587,13 +579,6 @@ declare function convertComponentToProps<T = unknown>(component: ComponentInstan
|
|
|
587
579
|
*/
|
|
588
580
|
declare const getParameterAttributes: typeof getParameterAttributes$1;
|
|
589
581
|
|
|
590
|
-
type UseCompositionEventEffectOptions = Omit<Partial<SubscribeToCompositionOptions>, 'callback'> & {
|
|
591
|
-
enabled: boolean;
|
|
592
|
-
effect: () => void;
|
|
593
|
-
};
|
|
594
|
-
/** Hook to manage a subscription to a realtime event on a composition */
|
|
595
|
-
declare function useCompositionEventEffect({ enabled, projectId, compositionId, effect, }: UseCompositionEventEffectOptions): void;
|
|
596
|
-
|
|
597
582
|
type UseUniformContextualEditingStateProps = {
|
|
598
583
|
/**
|
|
599
584
|
* When set to true, the hook will return the global contextual state no matter where its used.
|
|
@@ -643,4 +628,4 @@ declare const createComponentStoreResolver: (options: {
|
|
|
643
628
|
defaultComponent?: React$1.ComponentType<ComponentProps<any>>;
|
|
644
629
|
}) => RenderComponentResolver;
|
|
645
630
|
|
|
646
|
-
export { type ComponentProps, type ComponentStore, type CustomSlotChildRenderFunc, DefaultNotImplementedComponent, NOT_IMPLEMENTED_COMPONENT, type RenderComponentResolver, type RenderRichTextComponentResolver, type RichTextComponentProps, type RichTextRendererComponent, type SystemRenderConfig, type SystemRenderFunction, UniformComponent, type UniformComponentContextValue, type UniformComponentProps, UniformComposition, UniformCompositionContext, type UniformCompositionProps, UniformPlayground, type UniformPlaygroundDecorator, type UniformPlaygroundProps, UniformRichText, UniformRichTextNode, type UniformRichTextNodeProps, type UniformRichTextProps, UniformSlot, type UniformSlotProps, type UniformSlotWrapperComponentProps, UniformText, type UniformTextProps, type
|
|
631
|
+
export { type ComponentProps, type ComponentStore, type CustomSlotChildRenderFunc, DefaultNotImplementedComponent, NOT_IMPLEMENTED_COMPONENT, type RenderComponentResolver, type RenderRichTextComponentResolver, type RichTextComponentProps, type RichTextRendererComponent, type SystemRenderConfig, type SystemRenderFunction, UniformComponent, type UniformComponentContextValue, type UniformComponentProps, UniformComposition, UniformCompositionContext, type UniformCompositionProps, UniformPlayground, type UniformPlaygroundDecorator, type UniformPlaygroundProps, UniformRichText, UniformRichTextNode, type UniformRichTextNodeProps, type UniformRichTextProps, UniformSlot, type UniformSlotProps, type UniformSlotWrapperComponentProps, UniformText, type UniformTextProps, type UseUniformContextualEditingProps, type UseUniformContextualEditingStateProps, type UseUniformContextualEditingStateReturnType, componentStore, componentStoreResolver, convertComponentToProps, createComponentStore, createComponentStoreResolver, getParameterAttributes, registerUniformComponent, useUniformContextualEditing, useUniformContextualEditingState, useUniformCurrentComponent, useUniformCurrentComposition };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React$1, { Key, ReactNode, PropsWithChildren } from 'react';
|
|
2
|
-
import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, getParameterAttributes as getParameterAttributes$1,
|
|
2
|
+
import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, getParameterAttributes as getParameterAttributes$1, UpdateContextualEditingStateInternalMessage } from '@uniformdev/canvas';
|
|
3
3
|
export { GetParameterAttributesProps, createUniformApiEnhancer } from '@uniformdev/canvas';
|
|
4
4
|
import { P as PureUniformTextProps } from './PureUniformText-B3GAm6Dc.js';
|
|
5
5
|
import { RichTextNode } from '@uniformdev/richtext';
|
|
@@ -460,8 +460,6 @@ type UniformPlaygroundProps = {
|
|
|
460
460
|
* @deprecated This feature is not stable yet and might be changed or removed in a minor release. Do not use it in production environments.
|
|
461
461
|
*/
|
|
462
462
|
decorators?: UniformPlaygroundDecorator[];
|
|
463
|
-
/** @deprecated This prop is not supported anymore. */
|
|
464
|
-
children?: ReactNode;
|
|
465
463
|
} & Omit<UniformCompositionProps, 'data' | 'children'>;
|
|
466
464
|
/**
|
|
467
465
|
* Playground where you can freely live preview your components and patterns.
|
|
@@ -552,12 +550,6 @@ type UniformSlotProps<TSlotNames extends string> = {
|
|
|
552
550
|
* If not specified, the resolveRenderer function on the nearest Layout will be used, if any.
|
|
553
551
|
*/
|
|
554
552
|
resolveRenderer?: RenderComponentResolver;
|
|
555
|
-
/**
|
|
556
|
-
* Optional render props enables wrapping all child components in the slot with some markup
|
|
557
|
-
*
|
|
558
|
-
* @deprecated Use `wrapperComponent` instead and define wrapping component for slot children inside.
|
|
559
|
-
*/
|
|
560
|
-
children?: CustomSlotChildRenderFunc;
|
|
561
553
|
/**
|
|
562
554
|
* Optional wrapper component around list of slot items that allows to control
|
|
563
555
|
* exactly how to render slot items, otherwise React.Fragment is being used
|
|
@@ -571,7 +563,7 @@ type UniformSlotProps<TSlotNames extends string> = {
|
|
|
571
563
|
emptyPlaceholder?: React$1.ReactNode;
|
|
572
564
|
};
|
|
573
565
|
/** Renders a named Slot within a Composition. */
|
|
574
|
-
declare function UniformSlot<TSlotNames extends string = string>({ name, resolveRenderer,
|
|
566
|
+
declare function UniformSlot<TSlotNames extends string = string>({ name, resolveRenderer, emptyPlaceholder, wrapperComponent, }: UniformSlotProps<TSlotNames>): JSX.Element | null;
|
|
575
567
|
|
|
576
568
|
/**
|
|
577
569
|
* Converts a raw Canvas component instance to React component props format.
|
|
@@ -587,13 +579,6 @@ declare function convertComponentToProps<T = unknown>(component: ComponentInstan
|
|
|
587
579
|
*/
|
|
588
580
|
declare const getParameterAttributes: typeof getParameterAttributes$1;
|
|
589
581
|
|
|
590
|
-
type UseCompositionEventEffectOptions = Omit<Partial<SubscribeToCompositionOptions>, 'callback'> & {
|
|
591
|
-
enabled: boolean;
|
|
592
|
-
effect: () => void;
|
|
593
|
-
};
|
|
594
|
-
/** Hook to manage a subscription to a realtime event on a composition */
|
|
595
|
-
declare function useCompositionEventEffect({ enabled, projectId, compositionId, effect, }: UseCompositionEventEffectOptions): void;
|
|
596
|
-
|
|
597
582
|
type UseUniformContextualEditingStateProps = {
|
|
598
583
|
/**
|
|
599
584
|
* When set to true, the hook will return the global contextual state no matter where its used.
|
|
@@ -643,4 +628,4 @@ declare const createComponentStoreResolver: (options: {
|
|
|
643
628
|
defaultComponent?: React$1.ComponentType<ComponentProps<any>>;
|
|
644
629
|
}) => RenderComponentResolver;
|
|
645
630
|
|
|
646
|
-
export { type ComponentProps, type ComponentStore, type CustomSlotChildRenderFunc, DefaultNotImplementedComponent, NOT_IMPLEMENTED_COMPONENT, type RenderComponentResolver, type RenderRichTextComponentResolver, type RichTextComponentProps, type RichTextRendererComponent, type SystemRenderConfig, type SystemRenderFunction, UniformComponent, type UniformComponentContextValue, type UniformComponentProps, UniformComposition, UniformCompositionContext, type UniformCompositionProps, UniformPlayground, type UniformPlaygroundDecorator, type UniformPlaygroundProps, UniformRichText, UniformRichTextNode, type UniformRichTextNodeProps, type UniformRichTextProps, UniformSlot, type UniformSlotProps, type UniformSlotWrapperComponentProps, UniformText, type UniformTextProps, type
|
|
631
|
+
export { type ComponentProps, type ComponentStore, type CustomSlotChildRenderFunc, DefaultNotImplementedComponent, NOT_IMPLEMENTED_COMPONENT, type RenderComponentResolver, type RenderRichTextComponentResolver, type RichTextComponentProps, type RichTextRendererComponent, type SystemRenderConfig, type SystemRenderFunction, UniformComponent, type UniformComponentContextValue, type UniformComponentProps, UniformComposition, UniformCompositionContext, type UniformCompositionProps, UniformPlayground, type UniformPlaygroundDecorator, type UniformPlaygroundProps, UniformRichText, UniformRichTextNode, type UniformRichTextNodeProps, type UniformRichTextProps, UniformSlot, type UniformSlotProps, type UniformSlotWrapperComponentProps, UniformText, type UniformTextProps, type UseUniformContextualEditingProps, type UseUniformContextualEditingStateProps, type UseUniformContextualEditingStateReturnType, componentStore, componentStoreResolver, convertComponentToProps, createComponentStore, createComponentStoreResolver, getParameterAttributes, registerUniformComponent, useUniformContextualEditing, useUniformContextualEditingState, useUniformCurrentComponent, useUniformCurrentComposition };
|
package/dist/index.esm.js
CHANGED
|
@@ -447,7 +447,6 @@ function ContextualEditingComponentWrapper({
|
|
|
447
447
|
function UniformSlot({
|
|
448
448
|
name,
|
|
449
449
|
resolveRenderer,
|
|
450
|
-
children,
|
|
451
450
|
emptyPlaceholder,
|
|
452
451
|
wrapperComponent
|
|
453
452
|
}) {
|
|
@@ -478,8 +477,7 @@ function UniformSlot({
|
|
|
478
477
|
slotChildrenCount: slot.length,
|
|
479
478
|
emptyPlaceholder
|
|
480
479
|
});
|
|
481
|
-
|
|
482
|
-
return React6.createElement(React6.Fragment, { key: index }, elements);
|
|
480
|
+
return React6.createElement(React6.Fragment, { key: index }, child);
|
|
483
481
|
});
|
|
484
482
|
if (!wrapperComponent) {
|
|
485
483
|
return React6.createElement(React6.Fragment, void 0, finalChildren);
|
|
@@ -978,52 +976,12 @@ var getParameterAttributes = (options) => {
|
|
|
978
976
|
};
|
|
979
977
|
};
|
|
980
978
|
|
|
981
|
-
// src/hooks/useCompositionEventEffect.ts
|
|
982
|
-
import {
|
|
983
|
-
CANVAS_DRAFT_STATE,
|
|
984
|
-
createEventBus,
|
|
985
|
-
subscribeToComposition
|
|
986
|
-
} from "@uniformdev/canvas";
|
|
987
|
-
import { useEffect as useEffect2 } from "react";
|
|
988
|
-
function useCompositionEventEffect({
|
|
989
|
-
enabled,
|
|
990
|
-
projectId,
|
|
991
|
-
compositionId,
|
|
992
|
-
effect
|
|
993
|
-
}) {
|
|
994
|
-
useEffect2(() => {
|
|
995
|
-
if (!enabled || !compositionId || !projectId) {
|
|
996
|
-
return;
|
|
997
|
-
}
|
|
998
|
-
let goodbye = void 0;
|
|
999
|
-
const loadEffect = async () => {
|
|
1000
|
-
const eventBus = await createEventBus();
|
|
1001
|
-
if (eventBus) {
|
|
1002
|
-
goodbye = subscribeToComposition({
|
|
1003
|
-
eventBus,
|
|
1004
|
-
compositionId,
|
|
1005
|
-
compositionState: CANVAS_DRAFT_STATE,
|
|
1006
|
-
projectId,
|
|
1007
|
-
callback: effect,
|
|
1008
|
-
event: "updated"
|
|
1009
|
-
});
|
|
1010
|
-
}
|
|
1011
|
-
};
|
|
1012
|
-
loadEffect();
|
|
1013
|
-
return () => {
|
|
1014
|
-
if (goodbye) {
|
|
1015
|
-
goodbye();
|
|
1016
|
-
}
|
|
1017
|
-
};
|
|
1018
|
-
}, [compositionId, enabled, projectId, effect]);
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
979
|
// src/hooks/useUniformContextualEditingState.ts
|
|
1022
980
|
import {
|
|
1023
981
|
createCanvasChannel as createCanvasChannel2,
|
|
1024
982
|
isUpdateContextualEditingStateInternalMessage
|
|
1025
983
|
} from "@uniformdev/canvas";
|
|
1026
|
-
import { useEffect as
|
|
984
|
+
import { useEffect as useEffect2, useMemo as useMemo5, useState as useState3 } from "react";
|
|
1027
985
|
var useUniformContextualEditingState = ({
|
|
1028
986
|
global = false
|
|
1029
987
|
} = {}) => {
|
|
@@ -1043,7 +1001,7 @@ var useUniformContextualEditingState = ({
|
|
|
1043
1001
|
});
|
|
1044
1002
|
return channel2;
|
|
1045
1003
|
}, [isContextualEditing]);
|
|
1046
|
-
|
|
1004
|
+
useEffect2(() => {
|
|
1047
1005
|
var _a, _b;
|
|
1048
1006
|
if (!channel) {
|
|
1049
1007
|
return;
|
|
@@ -1095,7 +1053,6 @@ export {
|
|
|
1095
1053
|
createUniformApiEnhancer,
|
|
1096
1054
|
getParameterAttributes,
|
|
1097
1055
|
registerUniformComponent,
|
|
1098
|
-
useCompositionEventEffect,
|
|
1099
1056
|
useUniformContextualEditing,
|
|
1100
1057
|
useUniformContextualEditingState,
|
|
1101
1058
|
useUniformCurrentComponent,
|
package/dist/index.js
CHANGED
|
@@ -49,7 +49,6 @@ __export(src_exports, {
|
|
|
49
49
|
createUniformApiEnhancer: () => import_canvas6.createUniformApiEnhancer,
|
|
50
50
|
getParameterAttributes: () => getParameterAttributes,
|
|
51
51
|
registerUniformComponent: () => registerUniformComponent,
|
|
52
|
-
useCompositionEventEffect: () => useCompositionEventEffect,
|
|
53
52
|
useUniformContextualEditing: () => useUniformContextualEditing,
|
|
54
53
|
useUniformContextualEditingState: () => useUniformContextualEditingState,
|
|
55
54
|
useUniformCurrentComponent: () => useUniformCurrentComponent,
|
|
@@ -475,7 +474,6 @@ function ContextualEditingComponentWrapper({
|
|
|
475
474
|
function UniformSlot({
|
|
476
475
|
name,
|
|
477
476
|
resolveRenderer,
|
|
478
|
-
children,
|
|
479
477
|
emptyPlaceholder,
|
|
480
478
|
wrapperComponent
|
|
481
479
|
}) {
|
|
@@ -506,8 +504,7 @@ function UniformSlot({
|
|
|
506
504
|
slotChildrenCount: slot.length,
|
|
507
505
|
emptyPlaceholder
|
|
508
506
|
});
|
|
509
|
-
|
|
510
|
-
return import_react8.default.createElement(import_react8.default.Fragment, { key: index }, elements);
|
|
507
|
+
return import_react8.default.createElement(import_react8.default.Fragment, { key: index }, child);
|
|
511
508
|
});
|
|
512
509
|
if (!wrapperComponent) {
|
|
513
510
|
return import_react8.default.createElement(import_react8.default.Fragment, void 0, finalChildren);
|
|
@@ -1000,65 +997,29 @@ var getParameterAttributes = (options) => {
|
|
|
1000
997
|
};
|
|
1001
998
|
};
|
|
1002
999
|
|
|
1003
|
-
// src/hooks/
|
|
1000
|
+
// src/hooks/useUniformContextualEditingState.ts
|
|
1004
1001
|
var import_canvas13 = require("@uniformdev/canvas");
|
|
1005
1002
|
var import_react25 = require("react");
|
|
1006
|
-
function useCompositionEventEffect({
|
|
1007
|
-
enabled,
|
|
1008
|
-
projectId,
|
|
1009
|
-
compositionId,
|
|
1010
|
-
effect
|
|
1011
|
-
}) {
|
|
1012
|
-
(0, import_react25.useEffect)(() => {
|
|
1013
|
-
if (!enabled || !compositionId || !projectId) {
|
|
1014
|
-
return;
|
|
1015
|
-
}
|
|
1016
|
-
let goodbye = void 0;
|
|
1017
|
-
const loadEffect = async () => {
|
|
1018
|
-
const eventBus = await (0, import_canvas13.createEventBus)();
|
|
1019
|
-
if (eventBus) {
|
|
1020
|
-
goodbye = (0, import_canvas13.subscribeToComposition)({
|
|
1021
|
-
eventBus,
|
|
1022
|
-
compositionId,
|
|
1023
|
-
compositionState: import_canvas13.CANVAS_DRAFT_STATE,
|
|
1024
|
-
projectId,
|
|
1025
|
-
callback: effect,
|
|
1026
|
-
event: "updated"
|
|
1027
|
-
});
|
|
1028
|
-
}
|
|
1029
|
-
};
|
|
1030
|
-
loadEffect();
|
|
1031
|
-
return () => {
|
|
1032
|
-
if (goodbye) {
|
|
1033
|
-
goodbye();
|
|
1034
|
-
}
|
|
1035
|
-
};
|
|
1036
|
-
}, [compositionId, enabled, projectId, effect]);
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
// src/hooks/useUniformContextualEditingState.ts
|
|
1040
|
-
var import_canvas14 = require("@uniformdev/canvas");
|
|
1041
|
-
var import_react26 = require("react");
|
|
1042
1003
|
var useUniformContextualEditingState = ({
|
|
1043
1004
|
global = false
|
|
1044
1005
|
} = {}) => {
|
|
1045
1006
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
1046
1007
|
const { data: componentData } = useUniformCurrentComponent();
|
|
1047
|
-
const [selectedComponentReference, setSelectedComponentReference] = (0,
|
|
1048
|
-
const [previewMode, setPreviewMode] = (0,
|
|
1008
|
+
const [selectedComponentReference, setSelectedComponentReference] = (0, import_react25.useState)();
|
|
1009
|
+
const [previewMode, setPreviewMode] = (0, import_react25.useState)(
|
|
1049
1010
|
isContextualEditing ? "editor" : void 0
|
|
1050
1011
|
);
|
|
1051
|
-
const channel = (0,
|
|
1012
|
+
const channel = (0, import_react25.useMemo)(() => {
|
|
1052
1013
|
if (!isContextualEditing) {
|
|
1053
1014
|
return;
|
|
1054
1015
|
}
|
|
1055
|
-
const channel2 = (0,
|
|
1016
|
+
const channel2 = (0, import_canvas13.createCanvasChannel)({
|
|
1056
1017
|
broadcastTo: [window],
|
|
1057
1018
|
listenTo: [window]
|
|
1058
1019
|
});
|
|
1059
1020
|
return channel2;
|
|
1060
1021
|
}, [isContextualEditing]);
|
|
1061
|
-
(0,
|
|
1022
|
+
(0, import_react25.useEffect)(() => {
|
|
1062
1023
|
var _a, _b;
|
|
1063
1024
|
if (!channel) {
|
|
1064
1025
|
return;
|
|
@@ -1068,7 +1029,7 @@ var useUniformContextualEditingState = ({
|
|
|
1068
1029
|
}
|
|
1069
1030
|
const unsubscribe = channel.on("update-contextual-editing-state-internal", async (message) => {
|
|
1070
1031
|
var _a2;
|
|
1071
|
-
if (!(0,
|
|
1032
|
+
if (!(0, import_canvas13.isUpdateContextualEditingStateInternalMessage)(message)) {
|
|
1072
1033
|
return;
|
|
1073
1034
|
}
|
|
1074
1035
|
setPreviewMode(message.state.previewMode);
|
|
@@ -1082,7 +1043,7 @@ var useUniformContextualEditingState = ({
|
|
|
1082
1043
|
unsubscribe();
|
|
1083
1044
|
};
|
|
1084
1045
|
}, [global, channel, componentData == null ? void 0 : componentData._id, setSelectedComponentReference, setPreviewMode]);
|
|
1085
|
-
return (0,
|
|
1046
|
+
return (0, import_react25.useMemo)(
|
|
1086
1047
|
() => ({
|
|
1087
1048
|
isContextualEditing,
|
|
1088
1049
|
selectedComponentReference,
|
|
@@ -1111,7 +1072,6 @@ var useUniformContextualEditingState = ({
|
|
|
1111
1072
|
createUniformApiEnhancer,
|
|
1112
1073
|
getParameterAttributes,
|
|
1113
1074
|
registerUniformComponent,
|
|
1114
|
-
useCompositionEventEffect,
|
|
1115
1075
|
useUniformContextualEditing,
|
|
1116
1076
|
useUniformContextualEditingState,
|
|
1117
1077
|
useUniformCurrentComponent,
|
package/dist/index.mjs
CHANGED
|
@@ -447,7 +447,6 @@ function ContextualEditingComponentWrapper({
|
|
|
447
447
|
function UniformSlot({
|
|
448
448
|
name,
|
|
449
449
|
resolveRenderer,
|
|
450
|
-
children,
|
|
451
450
|
emptyPlaceholder,
|
|
452
451
|
wrapperComponent
|
|
453
452
|
}) {
|
|
@@ -478,8 +477,7 @@ function UniformSlot({
|
|
|
478
477
|
slotChildrenCount: slot.length,
|
|
479
478
|
emptyPlaceholder
|
|
480
479
|
});
|
|
481
|
-
|
|
482
|
-
return React6.createElement(React6.Fragment, { key: index }, elements);
|
|
480
|
+
return React6.createElement(React6.Fragment, { key: index }, child);
|
|
483
481
|
});
|
|
484
482
|
if (!wrapperComponent) {
|
|
485
483
|
return React6.createElement(React6.Fragment, void 0, finalChildren);
|
|
@@ -978,52 +976,12 @@ var getParameterAttributes = (options) => {
|
|
|
978
976
|
};
|
|
979
977
|
};
|
|
980
978
|
|
|
981
|
-
// src/hooks/useCompositionEventEffect.ts
|
|
982
|
-
import {
|
|
983
|
-
CANVAS_DRAFT_STATE,
|
|
984
|
-
createEventBus,
|
|
985
|
-
subscribeToComposition
|
|
986
|
-
} from "@uniformdev/canvas";
|
|
987
|
-
import { useEffect as useEffect2 } from "react";
|
|
988
|
-
function useCompositionEventEffect({
|
|
989
|
-
enabled,
|
|
990
|
-
projectId,
|
|
991
|
-
compositionId,
|
|
992
|
-
effect
|
|
993
|
-
}) {
|
|
994
|
-
useEffect2(() => {
|
|
995
|
-
if (!enabled || !compositionId || !projectId) {
|
|
996
|
-
return;
|
|
997
|
-
}
|
|
998
|
-
let goodbye = void 0;
|
|
999
|
-
const loadEffect = async () => {
|
|
1000
|
-
const eventBus = await createEventBus();
|
|
1001
|
-
if (eventBus) {
|
|
1002
|
-
goodbye = subscribeToComposition({
|
|
1003
|
-
eventBus,
|
|
1004
|
-
compositionId,
|
|
1005
|
-
compositionState: CANVAS_DRAFT_STATE,
|
|
1006
|
-
projectId,
|
|
1007
|
-
callback: effect,
|
|
1008
|
-
event: "updated"
|
|
1009
|
-
});
|
|
1010
|
-
}
|
|
1011
|
-
};
|
|
1012
|
-
loadEffect();
|
|
1013
|
-
return () => {
|
|
1014
|
-
if (goodbye) {
|
|
1015
|
-
goodbye();
|
|
1016
|
-
}
|
|
1017
|
-
};
|
|
1018
|
-
}, [compositionId, enabled, projectId, effect]);
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
979
|
// src/hooks/useUniformContextualEditingState.ts
|
|
1022
980
|
import {
|
|
1023
981
|
createCanvasChannel as createCanvasChannel2,
|
|
1024
982
|
isUpdateContextualEditingStateInternalMessage
|
|
1025
983
|
} from "@uniformdev/canvas";
|
|
1026
|
-
import { useEffect as
|
|
984
|
+
import { useEffect as useEffect2, useMemo as useMemo5, useState as useState3 } from "react";
|
|
1027
985
|
var useUniformContextualEditingState = ({
|
|
1028
986
|
global = false
|
|
1029
987
|
} = {}) => {
|
|
@@ -1043,7 +1001,7 @@ var useUniformContextualEditingState = ({
|
|
|
1043
1001
|
});
|
|
1044
1002
|
return channel2;
|
|
1045
1003
|
}, [isContextualEditing]);
|
|
1046
|
-
|
|
1004
|
+
useEffect2(() => {
|
|
1047
1005
|
var _a, _b;
|
|
1048
1006
|
if (!channel) {
|
|
1049
1007
|
return;
|
|
@@ -1095,7 +1053,6 @@ export {
|
|
|
1095
1053
|
createUniformApiEnhancer,
|
|
1096
1054
|
getParameterAttributes,
|
|
1097
1055
|
registerUniformComponent,
|
|
1098
|
-
useCompositionEventEffect,
|
|
1099
1056
|
useUniformContextualEditing,
|
|
1100
1057
|
useUniformContextualEditingState,
|
|
1101
1058
|
useUniformCurrentComponent,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-react",
|
|
3
|
-
"version": "19.214.
|
|
3
|
+
"version": "19.214.1-alpha.10+98dac3377a",
|
|
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.214.
|
|
49
|
-
"@uniformdev/context": "19.214.
|
|
50
|
-
"@uniformdev/context-react": "19.214.
|
|
51
|
-
"@uniformdev/richtext": "19.214.
|
|
48
|
+
"@uniformdev/canvas": "19.214.1-alpha.10+98dac3377a",
|
|
49
|
+
"@uniformdev/context": "19.214.1-alpha.10+98dac3377a",
|
|
50
|
+
"@uniformdev/context-react": "19.214.1-alpha.10+98dac3377a",
|
|
51
|
+
"@uniformdev/richtext": "19.214.1-alpha.10+98dac3377a"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"immer": ">= 10",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "98dac3377a8313b1d70d0b02632a6a7192f2409c"
|
|
71
71
|
}
|