mark.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import { CompositionComponent as CC } from '../runtime';
  2. import { Mark as MarkComposition } from '../spec';
  3. export type MarkOptions = Omit<MarkComposition, 'type'>;
  4. // @todo Move this to runtime.
  5. export const Mark: CC<MarkOptions> = () => {
  6. return (options) => {
  7. const {
  8. width,
  9. height,
  10. paddingLeft,
  11. paddingRight,
  12. paddingTop,
  13. paddingBottom,
  14. padding,
  15. inset,
  16. insetLeft,
  17. insetTop,
  18. insetRight,
  19. insetBottom,
  20. margin,
  21. marginLeft,
  22. marginBottom,
  23. marginTop,
  24. marginRight,
  25. data,
  26. coordinate,
  27. theme,
  28. component,
  29. interaction,
  30. x,
  31. y,
  32. key,
  33. frame,
  34. title,
  35. labelTransform,
  36. parentKey,
  37. clip,
  38. viewStyle,
  39. ...mark
  40. } = options;
  41. return [
  42. {
  43. type: 'standardView',
  44. x,
  45. y,
  46. key,
  47. width,
  48. height,
  49. padding,
  50. paddingLeft,
  51. paddingRight,
  52. paddingTop,
  53. inset,
  54. insetLeft,
  55. insetTop,
  56. insetRight,
  57. insetBottom,
  58. paddingBottom,
  59. theme,
  60. coordinate,
  61. component,
  62. interaction,
  63. frame,
  64. title,
  65. labelTransform,
  66. margin,
  67. marginLeft,
  68. marginBottom,
  69. marginTop,
  70. marginRight,
  71. parentKey,
  72. clip,
  73. style: viewStyle,
  74. marks: [{ ...mark, key: `${key}-0`, data }],
  75. },
  76. ];
  77. };
  78. };
  79. Mark.props = {};