@grapesjs/studio-sdk-plugins 1.0.29 → 1.0.30

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.
@@ -1,7 +1,7 @@
1
1
  import { LayoutCommandProps, LayoutConfig, RootLayoutConfig, StudioLayoutButtonConfigProps, StudioLayoutComponentsConfigProps, StudioLayoutSidebarLeftConfigProps } from '../types';
2
2
  import { PluginWithInit } from '../utils';
3
3
  import { LayoutSidebarButtonsOptions as LayoutSidebarButtonsOptionsSchema } from './typesSchema';
4
- export interface LayoutSidebarButtonsOptions extends Omit<LayoutSidebarButtonsOptionsSchema, 'sidebarButton' | 'rootLayout' | 'sidebarButtons'> {
4
+ export interface LayoutSidebarButtonsOptions extends Omit<LayoutSidebarButtonsOptionsSchema, 'sidebarButton' | 'rootLayout' | 'sidebarButtons' | 'sidebarLayoutCommand'> {
5
5
  /**
6
6
  * Customize each sidebar button.
7
7
  * @example
@@ -21,6 +21,22 @@ export interface LayoutSidebarButtonsOptions extends Omit<LayoutSidebarButtonsOp
21
21
  * }
22
22
  */
23
23
  sidebarButtons?: SidebarButtonsFn;
24
+ /**
25
+ * Customize the layout command object of each sidebar button.
26
+ *
27
+ * @example
28
+ * sidebarLayoutCommand: ({ layoutCommand }) => {
29
+ * if (layoutCommand.id === 'panelBlocks') {
30
+ * // Change the default placer to absolute right
31
+ * return {
32
+ * ...layoutCommand,
33
+ * placer: { type: 'absolute', position: 'right' }
34
+ * };
35
+ * }
36
+ * return layoutCommand;
37
+ * }
38
+ */
39
+ sidebarLayoutCommand?: SidebarLayoutCommandFn;
24
40
  /**
25
41
  * Customize the root layout per breakpoint.
26
42
  */
@@ -33,25 +49,31 @@ export interface LayoutSidebarButtonsOptions extends Omit<LayoutSidebarButtonsOp
33
49
  skipLayoutConfig?: boolean;
34
50
  }
35
51
  export interface BreakpointProps extends Required<Pick<LayoutSidebarButtonsOptionsSchema, 'breakpointTablet' | 'breakpointMobile'>> {
52
+ breakpoint: number;
36
53
  }
37
54
  export type SidebarButtonResult = StudioLayoutComponentsConfigProps | undefined | null | false;
38
55
  export type CreateSidebarButtonFn = (props: SidebarButtonProps) => StudioLayoutButtonConfigProps;
56
+ export interface CreateSidebarButtonOpts {
57
+ pluginOpts?: LayoutSidebarButtonsOptions;
58
+ breakpointProps: BreakpointProps;
59
+ }
39
60
  export type SidebarButtonFn = (props: {
40
61
  id: string;
41
62
  buttonIds: typeof SidebarButtonIds;
42
- breakpoint: number;
43
63
  sidebarButtonProps: SidebarButtonProps;
44
64
  buttonProps: StudioLayoutButtonConfigProps;
45
65
  createSidebarButton: (props: Partial<SidebarButtonProps>) => StudioLayoutButtonConfigProps;
46
66
  } & BreakpointProps) => SidebarButtonResult;
47
67
  export type SidebarButtonsFn = (props: {
48
68
  buttonIds: typeof SidebarButtonIds;
49
- breakpoint: number;
50
69
  sidebarButtons: StudioLayoutComponentsConfigProps[];
51
70
  createSidebarButton: CreateSidebarButtonFn;
52
71
  } & BreakpointProps) => SidebarButtonResult[];
72
+ export type SidebarLayoutCommandFn = (props: {
73
+ layoutCommand: LayoutCommandProps;
74
+ sidebarButtonProps: SidebarButtonProps;
75
+ } & BreakpointProps) => LayoutCommandProps;
53
76
  export type CustomRootLayoutFn = (props: {
54
- breakpoint: number;
55
77
  sidebarButtons: StudioLayoutComponentsConfigProps[];
56
78
  rootLayout: RootLayoutConfig;
57
79
  layoutSidebarTarget: RootLayoutConfig;
@@ -75,8 +97,9 @@ export declare enum SidebarButtonIds {
75
97
  panelGlobalStyles = "panelGlobalStyles",
76
98
  panelSidebarTabs = "panelSidebarTabs",
77
99
  panelAssets = "panelAssets",
78
- aiChatPanel = "aiChatPanel"
100
+ aiChatPanel = "aiChatPanel",
101
+ dataSourceManagerPanel = "dataSourceManagerPanel"
79
102
  }
80
103
  export interface SDKPluginWithLayoutConfig extends PluginWithInit<LayoutSidebarButtonsOptions> {
81
- createLayoutConfig: (options?: Pick<LayoutSidebarButtonsOptions, 'sidebarButton' | 'sidebarButtons' | 'rootLayout'>) => LayoutConfig;
104
+ createLayoutConfig: (options?: Pick<LayoutSidebarButtonsOptions, 'sidebarLayoutCommand' | 'sidebarButton' | 'sidebarButtons' | 'rootLayout'>) => LayoutConfig;
82
105
  }
@@ -19,6 +19,22 @@ export interface LayoutSidebarButtonsOptions extends SDKPluginOptions {
19
19
  * }
20
20
  */
21
21
  sidebarButtons?: '__fn__';
22
+ /**
23
+ * Customize the layout command object of each sidebar button.
24
+ *
25
+ * @examples
26
+ * sidebarLayoutCommand: ({ layoutCommand }) => {
27
+ * if (layoutCommand.id === 'panelBlocks') {
28
+ * // Change the default placer to absolute right
29
+ * return {
30
+ * ...layoutCommand,
31
+ * placer: { type: 'absolute', position: 'right' }
32
+ * };
33
+ * }
34
+ * return layoutCommand;
35
+ * }
36
+ */
37
+ sidebarLayoutCommand?: '__fn__';
22
38
  /**
23
39
  * Customize the resultant root layout per breakpoint.
24
40
  * @examples