project.d.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. // 页面id
  53. key: string;
  54. // 页面名称
  55. name: string;
  56. // 页面背景
  57. background: BackgroundOptions;
  58. // 页面元素
  59. elements: CustomElement[];
  60. // 辅助线
  61. referLines: ReferLine[];
  62. }
  63. // 项目基本信息
  64. declare export interface ProjectInfo {
  65. // 页面id
  66. pageId: string;
  67. // 项目名称
  68. name: string;
  69. // 项目描述
  70. description: string;
  71. // 尺寸类型
  72. sizeType: string;
  73. // 屏幕宽度
  74. width: number;
  75. // 屏幕高度
  76. height: number;
  77. // 填充方式
  78. fillType?: ScreenFillEnum;
  79. // 页面内容
  80. pages: Page[];
  81. }