-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuilder.types.ts
93 lines (81 loc) · 2.2 KB
/
Builder.types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// Builder.types.ts
/*
* Builder Type Definitions
*
* This file contains all the type definitions and interfaces used by the Builder class.
* It promotes reusability and better organization within the project.
*/
import { Section } from "./src/section/section";
import { Page } from "@selldone/core-js/models/shop/page/page.model";
import { Popup } from "@selldone/core-js/models/shop/popup/popup.model";
import { ShopMenu } from "@selldone/core-js/models/shop/design/menu.model";
/**
* Namespace containing all Builder-related types and interfaces.
*/
export namespace builder {
/**
* Defines the operational modes of the Builder.
*/
export type Mode = "edit" | "view";
/**
* Defines the types of models the Builder can handle.
*/
export type ModelType = "page" | "popup" | "menu";
/**
* Union type representing the possible models.
*/
export type IModel = Page | Popup | ShopMenu;
/**
* Function type for generating upload URLs based on model type and instance.
*/
export type IUploadUrlFunction = (
type: ModelType,
model: IModel,
) => string | null;
/**
* Interface representing server-related configurations.
*/
export interface IServer {
uploadImageUrl: IUploadUrlFunction;
uploadVideoUrl: IUploadUrlFunction;
}
/**
* Interface representing the options for initializing the Builder.
*/
export interface IOptions {
mode: Mode;
title: string;
sections: Section[];
style: any;
css: IPageCss | null | undefined;
columnsPrefix: {
mobile: string;
tablet: string;
desktop: string;
widescreen: string;
ultrawide: string;
};
// Edit mode only options:
server?: IServer;
type?: ModelType;
model?: IModel;
}
/**
* Interface representing the internal state of the Builder.
*/
export interface IState {
isEditing: boolean;
isHideExtra: boolean;
isSorting: boolean;
isRendered: boolean;
showLeftMenu: boolean; // Hide side menus when styler is visible
focusMode: boolean;
}
}
/**
* Type representing the CSS configuration for a page.
*/
export type IPageCss = {
classes: { selector: string; value: string }[] | null;
raw: string | null;
};