element_mask.erl 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. -module(element_mask).
  2. -author('Konstantin Zakablukovsky').
  3. -include("nitro.hrl").
  4. -compile(export_all).
  5. render_element(Record) ->
  6. wf_tags:emit_tag(<<"mask">>, nitro:render(Record#mask.body),
  7. lists:append([
  8. [
  9. {<<"id">>, Record#mask.id},
  10. {<<"class">>, Record#mask.class},
  11. {<<"style">>, Record#mask.style},
  12. {<<"maskUnits">>, Record#mask.maskUnits},
  13. {<<"maskContentUnits">>, Record#mask.maskContentUnits},
  14. {<<"x">>, Record#mask.x},
  15. {<<"y">>, Record#mask.y},
  16. {<<"width">>, Record#mask.width},
  17. {<<"height">>, Record#mask.height},
  18. {<<"externalResourcesRequired">>, Record#mask.externalResourcesRequired}
  19. ],
  20. svg_conditional_processing(Record),
  21. svg_core(Record),
  22. svg_presentation(Record),
  23. Record#mask.data_fields,
  24. Record#mask.aria_states
  25. ])).
  26. %% Common SVG attributes
  27. svg_conditional_processing(Record)-> [
  28. {<<"requiredExtensions">>, Record#mask.requiredExtensions},
  29. {<<"requiredFeatures">>, Record#mask.requiredFeatures},
  30. {<<"systemLanguage">>, Record#mask.systemLanguage}
  31. ].
  32. svg_core(Record)-> [
  33. {<<"xml:base">>, Record#mask.xmlbase},
  34. {<<"xml:lang">>, Record#mask.xmllang},
  35. {<<"xml:space">>, Record#mask.xmlspace}
  36. ].
  37. svg_presentation(Record)-> [
  38. {<<"alignment-baseline">>, Record#mask.alignment_baseline},
  39. {<<"baseline-shift">>, Record#mask.baseline_shift},
  40. {<<"clip">>, Record#mask.clip},
  41. {<<"clip-path">>, Record#mask.clip_path},
  42. {<<"clip-rule">>, Record#mask.clip_rule},
  43. {<<"color">>, Record#mask.color},
  44. {<<"color-interpolation">>, Record#mask.color_interpolation},
  45. {<<"color-interpolation-filters">>, Record#mask.color_interpolation_filters},
  46. {<<"color-profile">>, Record#mask.color_profile},
  47. {<<"color-rendering">>, Record#mask.color_rendering},
  48. {<<"cursor">>, Record#mask.cursor},
  49. {<<"direction">>, Record#mask.direction},
  50. {<<"display">>, Record#mask.display},
  51. {<<"dominant-baseline">>, Record#mask.dominant_baseline},
  52. {<<"enable-background">>, Record#mask.enable_background},
  53. {<<"fill">>, Record#mask.fill},
  54. {<<"fill-opacity">>, Record#mask.fill_opacity},
  55. {<<"fill-rule">>, Record#mask.fill_rule},
  56. {<<"filter">>, Record#mask.filter},
  57. {<<"flood-color">>, Record#mask.flood_color},
  58. {<<"flood-opacity">>, Record#mask.flood_opacity},
  59. {<<"font-family">>, Record#mask.font_family},
  60. {<<"font-size">>, Record#mask.font_size},
  61. {<<"font-size-adjust">>, Record#mask.font_size_adjust},
  62. {<<"font-stretch">>, Record#mask.font_stretch},
  63. {<<"font-style">>, Record#mask.font_style},
  64. {<<"font-variant">>, Record#mask.font_variant},
  65. {<<"font-weight">>, Record#mask.font_weight},
  66. {<<"glyph-orientation-horizontal">>, Record#mask.glyph_orientation_horizontal},
  67. {<<"glyph-orientation-vertical">>, Record#mask.glyph_orientation_vertical},
  68. {<<"image-rendering">>, Record#mask.image_rendering},
  69. {<<"kerning">>, Record#mask.kerning},
  70. {<<"letter-spacing">>, Record#mask.letter_spacing},
  71. {<<"lighting-color">>, Record#mask.lighting_color},
  72. {<<"marker-end">>, Record#mask.marker_end},
  73. {<<"marker-mid">>, Record#mask.marker_mid},
  74. {<<"marker-start">>, Record#mask.marker_start},
  75. {<<"mask">>, Record#mask.mask},
  76. {<<"opacity">>, Record#mask.opacity},
  77. {<<"overflow">>, Record#mask.overflow},
  78. {<<"pointer-events">>, Record#mask.pointer_events},
  79. {<<"shape-rendering">>, Record#mask.shape_rendering},
  80. {<<"stop-color">>, Record#mask.stop_color},
  81. {<<"stop-opacity">>, Record#mask.stop_opacity},
  82. {<<"stroke">>, Record#mask.stroke},
  83. {<<"stroke-dasharray">>, Record#mask.stroke_dasharray},
  84. {<<"stroke-dashoffset">>, Record#mask.stroke_dashoffset},
  85. {<<"stroke-linecap">>, Record#mask.stroke_linecap},
  86. {<<"stroke-linejoin">>, Record#mask.stroke_linejoin},
  87. {<<"stroke-miterlimit">>, Record#mask.stroke_miterlimit},
  88. {<<"stroke-opacity">>, Record#mask.stroke_opacity},
  89. {<<"stroke-width">>, Record#mask.stroke_width},
  90. {<<"text-anchor">>, Record#mask.text_anchor},
  91. {<<"text-decoration">>, Record#mask.text_decoration},
  92. {<<"text-rendering">>, Record#mask.text_rendering},
  93. {<<"unicode-bidi">>, Record#mask.unicode_bidi},
  94. {<<"visibility">>, Record#mask.visibility},
  95. {<<"word-spacing">>, Record#mask.word_spacing},
  96. {<<"writing-mode">>, Record#mask.writing_mode}
  97. ].