@uniformdev/canvas-vue 20.15.1-alpha.4 → 20.16.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 +35 -2
- package/dist/index.d.ts +35 -2
- package/dist/index.esm.js +63 -0
- package/dist/index.js +64 -3
- package/dist/index.mjs +63 -0
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { PropType, Component, Ref, ComputedRef, VNode, Slot } from 'vue';
|
|
3
|
-
import { ComponentInstance, ComponentParameter, RootComponentInstance, UpdateCompositionMessage } from '@uniformdev/canvas';
|
|
3
|
+
import { ComponentInstance, ComponentParameter, RootComponentInstance, UpdateCompositionMessage, UpdateContextualEditingStateInternalMessage } from '@uniformdev/canvas';
|
|
4
4
|
export { GetParameterAttributesProps, createUniformApiEnhancer, getParameterAttributes } from '@uniformdev/canvas';
|
|
5
5
|
import { RichTextNode } from '@uniformdev/richtext';
|
|
6
6
|
|
|
@@ -1038,6 +1038,39 @@ declare function renderComponent({ component, resolveRenderer, indexInSlot, slot
|
|
|
1038
1038
|
emptyPlaceholder?: Slot;
|
|
1039
1039
|
}): Component<any>;
|
|
1040
1040
|
|
|
1041
|
+
type UseUniformContextualEditingStateProps = {
|
|
1042
|
+
/**
|
|
1043
|
+
* When set to true, the hook will return the global contextual state no matter where its used.
|
|
1044
|
+
* When set to false, it will return only the state relevant to the current component (determined using `useUniformCurrentComponent`).
|
|
1045
|
+
* @default false
|
|
1046
|
+
**/
|
|
1047
|
+
global?: boolean;
|
|
1048
|
+
};
|
|
1049
|
+
type UseUniformContextualEditingStateReturnType = {
|
|
1050
|
+
/**
|
|
1051
|
+
* Returns `true` when the app is rendered inside Canvas editor. Regardless of which preview mode is currently selected ("editor" or "preview").
|
|
1052
|
+
*/
|
|
1053
|
+
isContextualEditing: Ref<boolean> | undefined;
|
|
1054
|
+
/**
|
|
1055
|
+
* A reference to the currently selected component in Canvas editor.
|
|
1056
|
+
* Returns `undefined` if the selected component is not part of the current React component.
|
|
1057
|
+
* Set the `global` option to `true` to get a reference of the selected component anywhere in the composition tree.
|
|
1058
|
+
*/
|
|
1059
|
+
selectedComponentReference: Ref<UpdateContextualEditingStateInternalMessage['state']['selectedComponentReference']>;
|
|
1060
|
+
/**
|
|
1061
|
+
* Returns the current preview mode in Canvas editor ("editor" or "preview").
|
|
1062
|
+
* Returns `undefined` when the app is not rendered inside Canvas editor.
|
|
1063
|
+
* Learn more about the preview modes: https://docs.uniform.app/docs/guides/composition/visual-editing#editing-and-preview-mode
|
|
1064
|
+
*/
|
|
1065
|
+
previewMode: Ref<UpdateContextualEditingStateInternalMessage['state']['previewMode'] | undefined>;
|
|
1066
|
+
};
|
|
1067
|
+
/**
|
|
1068
|
+
* Returns the state of contextual editing, when the app is open inside Canvas Editor.
|
|
1069
|
+
* This hook can be used to improve the editing experience of your team.
|
|
1070
|
+
* For example: You can use `selectedComponentReference` to control which element to show inside a carousel or an accordion.
|
|
1071
|
+
*/
|
|
1072
|
+
declare const useUniformContextualEditingState: ({ global: isGlobal, }?: UseUniformContextualEditingStateProps) => UseUniformContextualEditingStateReturnType;
|
|
1073
|
+
|
|
1041
1074
|
declare const globalCompositionEnhancerInjectionKey = "uniformGlobalCompositionEnhancer";
|
|
1042
1075
|
|
|
1043
1076
|
/**
|
|
@@ -1048,4 +1081,4 @@ declare const globalCompositionEnhancerInjectionKey = "uniformGlobalCompositionE
|
|
|
1048
1081
|
*/
|
|
1049
1082
|
declare function convertComponentToProps<T = unknown>(component: ComponentInstance): ComponentProps<T>;
|
|
1050
1083
|
|
|
1051
|
-
export { type ComponentProps, DefaultNotImplementedComponent, type DefaultNotImplementedComponentProps, HeadingRichTextNode, LinkRichTextNode, ListItemRichTextNode, ListRichTextNode, ParagraphRichTextNode, type PersonalizeComponent, QuoteRichTextNode, type RenderRichTextComponentResolver, type ResolveRenderer, type RichTextComponentProps, type RichTextRendererComponent, RootRichTextNode, TableCellRichTextNode, TableRichTextNode, TableRowRichTextNode, type TestComponent, TextRichTextNode, UniformComponent, type UniformComponentProps, UniformComposition, type UniformCompositionProps, UniformPlayground, type UniformPlaygroundProps, UniformRichText, UniformRichTextNode, type UniformRichTextNodeProps, type UniformRichTextProps, UniformSlot, type UniformSlotProps, UniformText, type UniformTextProps, type UseUniformContextualEditingProps, convertComponentToProps, globalCompositionEnhancerInjectionKey, renderComponent, useUniformContextualEditing, useUniformCurrentComponent, useUniformCurrentComposition };
|
|
1084
|
+
export { type ComponentProps, DefaultNotImplementedComponent, type DefaultNotImplementedComponentProps, HeadingRichTextNode, LinkRichTextNode, ListItemRichTextNode, ListRichTextNode, ParagraphRichTextNode, type PersonalizeComponent, QuoteRichTextNode, type RenderRichTextComponentResolver, type ResolveRenderer, type RichTextComponentProps, type RichTextRendererComponent, RootRichTextNode, TableCellRichTextNode, TableRichTextNode, TableRowRichTextNode, type TestComponent, TextRichTextNode, UniformComponent, type UniformComponentProps, UniformComposition, type UniformCompositionProps, UniformPlayground, type UniformPlaygroundProps, UniformRichText, UniformRichTextNode, type UniformRichTextNodeProps, type UniformRichTextProps, UniformSlot, type UniformSlotProps, UniformText, type UniformTextProps, type UseUniformContextualEditingProps, type UseUniformContextualEditingStateProps, type UseUniformContextualEditingStateReturnType, convertComponentToProps, globalCompositionEnhancerInjectionKey, renderComponent, useUniformContextualEditing, useUniformContextualEditingState, useUniformCurrentComponent, useUniformCurrentComposition };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { PropType, Component, Ref, ComputedRef, VNode, Slot } from 'vue';
|
|
3
|
-
import { ComponentInstance, ComponentParameter, RootComponentInstance, UpdateCompositionMessage } from '@uniformdev/canvas';
|
|
3
|
+
import { ComponentInstance, ComponentParameter, RootComponentInstance, UpdateCompositionMessage, UpdateContextualEditingStateInternalMessage } from '@uniformdev/canvas';
|
|
4
4
|
export { GetParameterAttributesProps, createUniformApiEnhancer, getParameterAttributes } from '@uniformdev/canvas';
|
|
5
5
|
import { RichTextNode } from '@uniformdev/richtext';
|
|
6
6
|
|
|
@@ -1038,6 +1038,39 @@ declare function renderComponent({ component, resolveRenderer, indexInSlot, slot
|
|
|
1038
1038
|
emptyPlaceholder?: Slot;
|
|
1039
1039
|
}): Component<any>;
|
|
1040
1040
|
|
|
1041
|
+
type UseUniformContextualEditingStateProps = {
|
|
1042
|
+
/**
|
|
1043
|
+
* When set to true, the hook will return the global contextual state no matter where its used.
|
|
1044
|
+
* When set to false, it will return only the state relevant to the current component (determined using `useUniformCurrentComponent`).
|
|
1045
|
+
* @default false
|
|
1046
|
+
**/
|
|
1047
|
+
global?: boolean;
|
|
1048
|
+
};
|
|
1049
|
+
type UseUniformContextualEditingStateReturnType = {
|
|
1050
|
+
/**
|
|
1051
|
+
* Returns `true` when the app is rendered inside Canvas editor. Regardless of which preview mode is currently selected ("editor" or "preview").
|
|
1052
|
+
*/
|
|
1053
|
+
isContextualEditing: Ref<boolean> | undefined;
|
|
1054
|
+
/**
|
|
1055
|
+
* A reference to the currently selected component in Canvas editor.
|
|
1056
|
+
* Returns `undefined` if the selected component is not part of the current React component.
|
|
1057
|
+
* Set the `global` option to `true` to get a reference of the selected component anywhere in the composition tree.
|
|
1058
|
+
*/
|
|
1059
|
+
selectedComponentReference: Ref<UpdateContextualEditingStateInternalMessage['state']['selectedComponentReference']>;
|
|
1060
|
+
/**
|
|
1061
|
+
* Returns the current preview mode in Canvas editor ("editor" or "preview").
|
|
1062
|
+
* Returns `undefined` when the app is not rendered inside Canvas editor.
|
|
1063
|
+
* Learn more about the preview modes: https://docs.uniform.app/docs/guides/composition/visual-editing#editing-and-preview-mode
|
|
1064
|
+
*/
|
|
1065
|
+
previewMode: Ref<UpdateContextualEditingStateInternalMessage['state']['previewMode'] | undefined>;
|
|
1066
|
+
};
|
|
1067
|
+
/**
|
|
1068
|
+
* Returns the state of contextual editing, when the app is open inside Canvas Editor.
|
|
1069
|
+
* This hook can be used to improve the editing experience of your team.
|
|
1070
|
+
* For example: You can use `selectedComponentReference` to control which element to show inside a carousel or an accordion.
|
|
1071
|
+
*/
|
|
1072
|
+
declare const useUniformContextualEditingState: ({ global: isGlobal, }?: UseUniformContextualEditingStateProps) => UseUniformContextualEditingStateReturnType;
|
|
1073
|
+
|
|
1041
1074
|
declare const globalCompositionEnhancerInjectionKey = "uniformGlobalCompositionEnhancer";
|
|
1042
1075
|
|
|
1043
1076
|
/**
|
|
@@ -1048,4 +1081,4 @@ declare const globalCompositionEnhancerInjectionKey = "uniformGlobalCompositionE
|
|
|
1048
1081
|
*/
|
|
1049
1082
|
declare function convertComponentToProps<T = unknown>(component: ComponentInstance): ComponentProps<T>;
|
|
1050
1083
|
|
|
1051
|
-
export { type ComponentProps, DefaultNotImplementedComponent, type DefaultNotImplementedComponentProps, HeadingRichTextNode, LinkRichTextNode, ListItemRichTextNode, ListRichTextNode, ParagraphRichTextNode, type PersonalizeComponent, QuoteRichTextNode, type RenderRichTextComponentResolver, type ResolveRenderer, type RichTextComponentProps, type RichTextRendererComponent, RootRichTextNode, TableCellRichTextNode, TableRichTextNode, TableRowRichTextNode, type TestComponent, TextRichTextNode, UniformComponent, type UniformComponentProps, UniformComposition, type UniformCompositionProps, UniformPlayground, type UniformPlaygroundProps, UniformRichText, UniformRichTextNode, type UniformRichTextNodeProps, type UniformRichTextProps, UniformSlot, type UniformSlotProps, UniformText, type UniformTextProps, type UseUniformContextualEditingProps, convertComponentToProps, globalCompositionEnhancerInjectionKey, renderComponent, useUniformContextualEditing, useUniformCurrentComponent, useUniformCurrentComposition };
|
|
1084
|
+
export { type ComponentProps, DefaultNotImplementedComponent, type DefaultNotImplementedComponentProps, HeadingRichTextNode, LinkRichTextNode, ListItemRichTextNode, ListRichTextNode, ParagraphRichTextNode, type PersonalizeComponent, QuoteRichTextNode, type RenderRichTextComponentResolver, type ResolveRenderer, type RichTextComponentProps, type RichTextRendererComponent, RootRichTextNode, TableCellRichTextNode, TableRichTextNode, TableRowRichTextNode, type TestComponent, TextRichTextNode, UniformComponent, type UniformComponentProps, UniformComposition, type UniformCompositionProps, UniformPlayground, type UniformPlaygroundProps, UniformRichText, UniformRichTextNode, type UniformRichTextNodeProps, type UniformRichTextProps, UniformSlot, type UniformSlotProps, UniformText, type UniformTextProps, type UseUniformContextualEditingProps, type UseUniformContextualEditingStateProps, type UseUniformContextualEditingStateReturnType, convertComponentToProps, globalCompositionEnhancerInjectionKey, renderComponent, useUniformContextualEditing, useUniformContextualEditingState, useUniformCurrentComponent, useUniformCurrentComposition };
|
package/dist/index.esm.js
CHANGED
|
@@ -974,6 +974,68 @@ var UniformText = defineComponent9({
|
|
|
974
974
|
}
|
|
975
975
|
});
|
|
976
976
|
|
|
977
|
+
// src/composables/useUniformContextualEditingState.ts
|
|
978
|
+
import {
|
|
979
|
+
createCanvasChannel as createCanvasChannel2,
|
|
980
|
+
isUpdateContextualEditingStateInternalMessage
|
|
981
|
+
} from "@uniformdev/canvas";
|
|
982
|
+
import { computed as computed7, ref as ref3, watch as watch2 } from "vue";
|
|
983
|
+
var useUniformContextualEditingState = ({
|
|
984
|
+
global: isGlobal = false
|
|
985
|
+
} = {}) => {
|
|
986
|
+
const { isContextualEditing } = useUniformCurrentComposition();
|
|
987
|
+
const { data: componentData } = useUniformCurrentComponent();
|
|
988
|
+
const selectedComponentReference = ref3();
|
|
989
|
+
const previewMode = ref3(
|
|
990
|
+
isContextualEditing ? "editor" : void 0
|
|
991
|
+
);
|
|
992
|
+
const channel = computed7(() => {
|
|
993
|
+
if (!isContextualEditing) {
|
|
994
|
+
return;
|
|
995
|
+
}
|
|
996
|
+
const channel2 = createCanvasChannel2({
|
|
997
|
+
broadcastTo: [window],
|
|
998
|
+
listenTo: [window]
|
|
999
|
+
});
|
|
1000
|
+
return channel2;
|
|
1001
|
+
});
|
|
1002
|
+
watch2(
|
|
1003
|
+
[() => isGlobal, () => componentData == null ? void 0 : componentData._id, channel],
|
|
1004
|
+
(_newValue, _oldValue, onCleanup) => {
|
|
1005
|
+
var _a, _b;
|
|
1006
|
+
if (!channel.value) {
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
if (typeof window !== "undefined") {
|
|
1010
|
+
previewMode.value = (_b = (_a = window.__UNIFORM_CONTEXTUAL_EDITING__) == null ? void 0 : _a.state) == null ? void 0 : _b.previewMode;
|
|
1011
|
+
}
|
|
1012
|
+
const unsubscribe = channel.value.on("update-contextual-editing-state-internal", async (message) => {
|
|
1013
|
+
var _a2;
|
|
1014
|
+
if (!isUpdateContextualEditingStateInternalMessage(message)) {
|
|
1015
|
+
return;
|
|
1016
|
+
}
|
|
1017
|
+
previewMode.value = message.state.previewMode;
|
|
1018
|
+
if (!global && (componentData == null ? void 0 : componentData._id) !== ((_a2 = message.state.selectedComponentReference) == null ? void 0 : _a2.parentId)) {
|
|
1019
|
+
selectedComponentReference.value = void 0;
|
|
1020
|
+
return;
|
|
1021
|
+
}
|
|
1022
|
+
selectedComponentReference.value = message.state.selectedComponentReference;
|
|
1023
|
+
});
|
|
1024
|
+
onCleanup(() => {
|
|
1025
|
+
unsubscribe();
|
|
1026
|
+
});
|
|
1027
|
+
},
|
|
1028
|
+
{
|
|
1029
|
+
immediate: true
|
|
1030
|
+
}
|
|
1031
|
+
);
|
|
1032
|
+
return {
|
|
1033
|
+
isContextualEditing,
|
|
1034
|
+
selectedComponentReference,
|
|
1035
|
+
previewMode
|
|
1036
|
+
};
|
|
1037
|
+
};
|
|
1038
|
+
|
|
977
1039
|
// src/helpers/getParameterAttributes.ts
|
|
978
1040
|
import { getParameterAttributes } from "@uniformdev/canvas";
|
|
979
1041
|
export {
|
|
@@ -1002,6 +1064,7 @@ export {
|
|
|
1002
1064
|
globalCompositionEnhancerInjectionKey,
|
|
1003
1065
|
renderComponent,
|
|
1004
1066
|
useUniformContextualEditing,
|
|
1067
|
+
useUniformContextualEditingState,
|
|
1005
1068
|
useUniformCurrentComponent,
|
|
1006
1069
|
useUniformCurrentComposition
|
|
1007
1070
|
};
|
package/dist/index.js
CHANGED
|
@@ -41,10 +41,11 @@ __export(src_exports, {
|
|
|
41
41
|
UniformText: () => UniformText,
|
|
42
42
|
convertComponentToProps: () => convertComponentToProps,
|
|
43
43
|
createUniformApiEnhancer: () => import_canvas3.createUniformApiEnhancer,
|
|
44
|
-
getParameterAttributes: () =>
|
|
44
|
+
getParameterAttributes: () => import_canvas10.getParameterAttributes,
|
|
45
45
|
globalCompositionEnhancerInjectionKey: () => globalCompositionEnhancerInjectionKey,
|
|
46
46
|
renderComponent: () => renderComponent,
|
|
47
47
|
useUniformContextualEditing: () => useUniformContextualEditing,
|
|
48
|
+
useUniformContextualEditingState: () => useUniformContextualEditingState,
|
|
48
49
|
useUniformCurrentComponent: () => useUniformCurrentComponent,
|
|
49
50
|
useUniformCurrentComposition: () => useUniformCurrentComposition
|
|
50
51
|
});
|
|
@@ -967,7 +968,7 @@ var UniformText = (0, import_vue24.defineComponent)({
|
|
|
967
968
|
return (0, import_vue24.h)(
|
|
968
969
|
(_a2 = props.as) != null ? _a2 : DEFAULT_ELEMENT_TYPE,
|
|
969
970
|
{
|
|
970
|
-
...(0,
|
|
971
|
+
...(0, import_canvas10.getParameterAttributes)({
|
|
971
972
|
component: componentData,
|
|
972
973
|
id: props.parameterId,
|
|
973
974
|
isMultiline: props.isMultiline
|
|
@@ -985,8 +986,67 @@ var UniformText = (0, import_vue24.defineComponent)({
|
|
|
985
986
|
}
|
|
986
987
|
});
|
|
987
988
|
|
|
988
|
-
// src/
|
|
989
|
+
// src/composables/useUniformContextualEditingState.ts
|
|
989
990
|
var import_canvas9 = require("@uniformdev/canvas");
|
|
991
|
+
var import_vue25 = require("vue");
|
|
992
|
+
var useUniformContextualEditingState = ({
|
|
993
|
+
global: isGlobal = false
|
|
994
|
+
} = {}) => {
|
|
995
|
+
const { isContextualEditing } = useUniformCurrentComposition();
|
|
996
|
+
const { data: componentData } = useUniformCurrentComponent();
|
|
997
|
+
const selectedComponentReference = (0, import_vue25.ref)();
|
|
998
|
+
const previewMode = (0, import_vue25.ref)(
|
|
999
|
+
isContextualEditing ? "editor" : void 0
|
|
1000
|
+
);
|
|
1001
|
+
const channel = (0, import_vue25.computed)(() => {
|
|
1002
|
+
if (!isContextualEditing) {
|
|
1003
|
+
return;
|
|
1004
|
+
}
|
|
1005
|
+
const channel2 = (0, import_canvas9.createCanvasChannel)({
|
|
1006
|
+
broadcastTo: [window],
|
|
1007
|
+
listenTo: [window]
|
|
1008
|
+
});
|
|
1009
|
+
return channel2;
|
|
1010
|
+
});
|
|
1011
|
+
(0, import_vue25.watch)(
|
|
1012
|
+
[() => isGlobal, () => componentData == null ? void 0 : componentData._id, channel],
|
|
1013
|
+
(_newValue, _oldValue, onCleanup) => {
|
|
1014
|
+
var _a, _b;
|
|
1015
|
+
if (!channel.value) {
|
|
1016
|
+
return;
|
|
1017
|
+
}
|
|
1018
|
+
if (typeof window !== "undefined") {
|
|
1019
|
+
previewMode.value = (_b = (_a = window.__UNIFORM_CONTEXTUAL_EDITING__) == null ? void 0 : _a.state) == null ? void 0 : _b.previewMode;
|
|
1020
|
+
}
|
|
1021
|
+
const unsubscribe = channel.value.on("update-contextual-editing-state-internal", async (message) => {
|
|
1022
|
+
var _a2;
|
|
1023
|
+
if (!(0, import_canvas9.isUpdateContextualEditingStateInternalMessage)(message)) {
|
|
1024
|
+
return;
|
|
1025
|
+
}
|
|
1026
|
+
previewMode.value = message.state.previewMode;
|
|
1027
|
+
if (!global && (componentData == null ? void 0 : componentData._id) !== ((_a2 = message.state.selectedComponentReference) == null ? void 0 : _a2.parentId)) {
|
|
1028
|
+
selectedComponentReference.value = void 0;
|
|
1029
|
+
return;
|
|
1030
|
+
}
|
|
1031
|
+
selectedComponentReference.value = message.state.selectedComponentReference;
|
|
1032
|
+
});
|
|
1033
|
+
onCleanup(() => {
|
|
1034
|
+
unsubscribe();
|
|
1035
|
+
});
|
|
1036
|
+
},
|
|
1037
|
+
{
|
|
1038
|
+
immediate: true
|
|
1039
|
+
}
|
|
1040
|
+
);
|
|
1041
|
+
return {
|
|
1042
|
+
isContextualEditing,
|
|
1043
|
+
selectedComponentReference,
|
|
1044
|
+
previewMode
|
|
1045
|
+
};
|
|
1046
|
+
};
|
|
1047
|
+
|
|
1048
|
+
// src/helpers/getParameterAttributes.ts
|
|
1049
|
+
var import_canvas10 = require("@uniformdev/canvas");
|
|
990
1050
|
// Annotate the CommonJS export names for ESM import in node:
|
|
991
1051
|
0 && (module.exports = {
|
|
992
1052
|
DefaultNotImplementedComponent,
|
|
@@ -1014,6 +1074,7 @@ var import_canvas9 = require("@uniformdev/canvas");
|
|
|
1014
1074
|
globalCompositionEnhancerInjectionKey,
|
|
1015
1075
|
renderComponent,
|
|
1016
1076
|
useUniformContextualEditing,
|
|
1077
|
+
useUniformContextualEditingState,
|
|
1017
1078
|
useUniformCurrentComponent,
|
|
1018
1079
|
useUniformCurrentComposition
|
|
1019
1080
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -974,6 +974,68 @@ var UniformText = defineComponent9({
|
|
|
974
974
|
}
|
|
975
975
|
});
|
|
976
976
|
|
|
977
|
+
// src/composables/useUniformContextualEditingState.ts
|
|
978
|
+
import {
|
|
979
|
+
createCanvasChannel as createCanvasChannel2,
|
|
980
|
+
isUpdateContextualEditingStateInternalMessage
|
|
981
|
+
} from "@uniformdev/canvas";
|
|
982
|
+
import { computed as computed7, ref as ref3, watch as watch2 } from "vue";
|
|
983
|
+
var useUniformContextualEditingState = ({
|
|
984
|
+
global: isGlobal = false
|
|
985
|
+
} = {}) => {
|
|
986
|
+
const { isContextualEditing } = useUniformCurrentComposition();
|
|
987
|
+
const { data: componentData } = useUniformCurrentComponent();
|
|
988
|
+
const selectedComponentReference = ref3();
|
|
989
|
+
const previewMode = ref3(
|
|
990
|
+
isContextualEditing ? "editor" : void 0
|
|
991
|
+
);
|
|
992
|
+
const channel = computed7(() => {
|
|
993
|
+
if (!isContextualEditing) {
|
|
994
|
+
return;
|
|
995
|
+
}
|
|
996
|
+
const channel2 = createCanvasChannel2({
|
|
997
|
+
broadcastTo: [window],
|
|
998
|
+
listenTo: [window]
|
|
999
|
+
});
|
|
1000
|
+
return channel2;
|
|
1001
|
+
});
|
|
1002
|
+
watch2(
|
|
1003
|
+
[() => isGlobal, () => componentData == null ? void 0 : componentData._id, channel],
|
|
1004
|
+
(_newValue, _oldValue, onCleanup) => {
|
|
1005
|
+
var _a, _b;
|
|
1006
|
+
if (!channel.value) {
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
if (typeof window !== "undefined") {
|
|
1010
|
+
previewMode.value = (_b = (_a = window.__UNIFORM_CONTEXTUAL_EDITING__) == null ? void 0 : _a.state) == null ? void 0 : _b.previewMode;
|
|
1011
|
+
}
|
|
1012
|
+
const unsubscribe = channel.value.on("update-contextual-editing-state-internal", async (message) => {
|
|
1013
|
+
var _a2;
|
|
1014
|
+
if (!isUpdateContextualEditingStateInternalMessage(message)) {
|
|
1015
|
+
return;
|
|
1016
|
+
}
|
|
1017
|
+
previewMode.value = message.state.previewMode;
|
|
1018
|
+
if (!global && (componentData == null ? void 0 : componentData._id) !== ((_a2 = message.state.selectedComponentReference) == null ? void 0 : _a2.parentId)) {
|
|
1019
|
+
selectedComponentReference.value = void 0;
|
|
1020
|
+
return;
|
|
1021
|
+
}
|
|
1022
|
+
selectedComponentReference.value = message.state.selectedComponentReference;
|
|
1023
|
+
});
|
|
1024
|
+
onCleanup(() => {
|
|
1025
|
+
unsubscribe();
|
|
1026
|
+
});
|
|
1027
|
+
},
|
|
1028
|
+
{
|
|
1029
|
+
immediate: true
|
|
1030
|
+
}
|
|
1031
|
+
);
|
|
1032
|
+
return {
|
|
1033
|
+
isContextualEditing,
|
|
1034
|
+
selectedComponentReference,
|
|
1035
|
+
previewMode
|
|
1036
|
+
};
|
|
1037
|
+
};
|
|
1038
|
+
|
|
977
1039
|
// src/helpers/getParameterAttributes.ts
|
|
978
1040
|
import { getParameterAttributes } from "@uniformdev/canvas";
|
|
979
1041
|
export {
|
|
@@ -1002,6 +1064,7 @@ export {
|
|
|
1002
1064
|
globalCompositionEnhancerInjectionKey,
|
|
1003
1065
|
renderComponent,
|
|
1004
1066
|
useUniformContextualEditing,
|
|
1067
|
+
useUniformContextualEditingState,
|
|
1005
1068
|
useUniformCurrentComponent,
|
|
1006
1069
|
useUniformCurrentComposition
|
|
1007
1070
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-vue",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.16.0",
|
|
4
4
|
"description": "Vue SDK for Uniform Canvas",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"document:prebuild": "api-extractor run --local"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@uniformdev/canvas": "20.
|
|
34
|
-
"@uniformdev/context-vue": "20.
|
|
35
|
-
"@uniformdev/richtext": "20.
|
|
33
|
+
"@uniformdev/canvas": "20.16.0",
|
|
34
|
+
"@uniformdev/context-vue": "20.16.0",
|
|
35
|
+
"@uniformdev/richtext": "20.16.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"vue": ">=3.0.0"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@vue/server-test-utils": "1.3.0",
|
|
49
49
|
"@vue/test-utils": "2.4.6",
|
|
50
50
|
"@vue/vue3-jest": "^29.2.6",
|
|
51
|
-
"vue": "3.5.
|
|
51
|
+
"vue": "3.5.13",
|
|
52
52
|
"vue-server-renderer": "2.7.16",
|
|
53
53
|
"vue-template-compiler": "2.7.16"
|
|
54
54
|
},
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "47fa333abf187cd58ab9edb6b5fe970bbc24b4f7"
|
|
68
68
|
}
|