project.d.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. // 页面id
  64. pageId: string;
  65. // 项目名称
  66. name: string;
  67. // 项目描述
  68. description: string;
  69. // 尺寸类型
  70. sizeType: string;
  71. // 屏幕宽度
  72. width: number;
  73. // 屏幕高度
  74. height: number;
  75. // 填充方式
  76. fillType?: ScreenFillEnum;
  77. // 页面内容
  78. pages: Page[];
  79. }