project.d.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import type { ComponentType } from "@/components";
  2. interface BackgroundOptions {
  3. // 背景类型
  4. type: 'color' | 'image';
  5. // 背景颜色
  6. color?: string;
  7. // 背景图片
  8. image?: string;
  9. // 背景图片填充方式
  10. fillType?: string;
  11. }
  12. interface CustomElement {
  13. // 元素唯一标识
  14. key: number;
  15. // 元素名称
  16. name: string;
  17. // 组件类型
  18. componentType: ComponentType;
  19. // 元素位置
  20. position: {
  21. x: number;
  22. y: number;
  23. };
  24. // 元素尺寸
  25. size: {
  26. width: number;
  27. height: number;
  28. };
  29. // 元素层级
  30. zIndex: number;
  31. // 元素属性 -- 包含样式,组件属性
  32. props: Record<string, any>;
  33. // 元素交互
  34. events: Record<string, any>;
  35. // 元素动画
  36. animations: Record<string, any>;
  37. // 元素内容 -- 数据源
  38. content: Record<string, any>;
  39. }
  40. export interface ReferLine {
  41. // 辅助线唯一标识
  42. key: number;
  43. // 辅助线类型
  44. type: 'horizontal' | 'vertical' | null;
  45. // 辅助线位置
  46. value: number;
  47. // x坐标
  48. x?: number;
  49. // y坐标
  50. y?: number;
  51. }
  52. interface Page {
  53. // 页面名称
  54. name: string;
  55. // 页面背景
  56. background: BackgroundOptions;
  57. // 页面元素
  58. elements: CustomElement[];
  59. // 辅助线
  60. referLines: ReferLine[];
  61. }
  62. // 项目基本信息
  63. export interface ProjectInfo {
  64. // 项目名称
  65. name: string;
  66. // 项目描述
  67. description: string;
  68. // 尺寸类型
  69. sizeType: string;
  70. // 屏幕宽度
  71. width: number;
  72. // 屏幕高度
  73. height: number;
  74. // 填充方式
  75. fillType?: ScreenFillEnum;
  76. // 页面内容
  77. pages: Page[];
  78. }