project.d.ts 1.8 KB

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