project.d.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import type { ComponentType } from "@/components";
  2. declare interface BackgroundOptions {
  3. // 背景类型
  4. type: 'color' | 'image' | 'none';
  5. // 背景颜色
  6. color?: string;
  7. // 背景图片
  8. image?: string;
  9. // 背景图片填充方式
  10. fillType?: "cover" | "contain" | "fill" | "";
  11. }
  12. declare interface CustomElement {
  13. // 元素唯一标识
  14. key: number;
  15. // 元素名称
  16. name: string;
  17. // 组件类型
  18. componentType: ComponentType;
  19. // 元素层级
  20. zIndex: number;
  21. // 是否可见
  22. visible: boolean;
  23. // 是否锁定
  24. locked: boolean;
  25. // 容器样式 -- 包含样式,组件属性
  26. container: {
  27. // 元素样式
  28. style: Record<string, any>;
  29. // 元素属性
  30. props: Record<string, any>;
  31. };
  32. // 元素交互
  33. events: Record<string, any>;
  34. // 元素动画
  35. animations: Record<string, any>;
  36. // 组件内容 -- 数据源, 数据样式等
  37. props: 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. }