project.d.ts 1.6 KB

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