duid_core/core/svg/
attributes.rs

1use crate::core::html::attributes::{AttributeValue, Value, attr, attr_ns};
2use crate::declare_attributes;
3
4pub(in crate) const XLINK_NAMESPACE: &str = "http://www.w3.org/1999/xlink";
5
6macro_rules! declare_xlink_attributes {
7    ( $(
8         $(#[$attr:meta])*
9         $name:ident => $attribute:tt;
10       )*
11     ) => {
12        $(
13            $(#[$attr])*
14            #[inline]
15            #[allow(non_snake_case)]
16            pub fn $name<V, MSG>(v: V) -> crate::core::html::attributes::Attribute<MSG>
17                where V: Into<Value>,
18                {
19                    attr_ns(Some(XLINK_NAMESPACE), $attribute, AttributeValue::from_value(v.into()))
20                }
21         )*
22
23        #[cfg(feature = "with-lookup")]
24        pub const SVG_ATTRS_XLINK:[(&'static str,&'static str); 7] = [$((stringify!($name),$attribute),)*];
25    }
26}
27
28macro_rules! declare_svg_attributes{
29    ( $(
30         $(#[$attr:meta])*
31         $name:ident;
32       )*
33     ) => {
34        declare_attributes!{ $($name;)*}
35
36        #[cfg(feature = "with-lookup")]
37        pub const SVG_ATTRS:[&'static str; 168] = [$(stringify!($name),)*];
38    }
39}
40
41macro_rules! declare_svg_attributes_special{
42    ( $(
43         $(#[$attr:meta])*
44         $name:ident => $attribute:tt;
45       )*
46     ) => {
47        declare_attributes!{ $($name => $attribute;)*}
48
49        #[cfg(feature = "with-lookup")]
50        pub const SVG_ATTRS_SPECIAL:[(&'static str,&'static str); 76] = [$((stringify!($name),$attribute),)*];
51    }
52}
53
54declare_svg_attributes! {
55    accumulate;
56    additive;
57    allowReorder;
58    alphabetic;
59    amplitude;
60    ascent;
61    attributeName;
62    attributeType;
63    autoReverse;
64    azimuth;
65    baseFrequency;
66    baseProfile;
67    bbox;
68    begin;
69    bias;
70    by;
71    calcMode;
72    clip;
73    clipPathUnits;
74    color;
75    contentScriptType;
76    contentStyleType;
77    cursor;
78    cx;
79    cy;
80    d;
81    decelerate;
82    descent;
83    diffuseConstant;
84    direction;
85    display;
86    divisor;
87    dur;
88    dx;
89    dy;
90    edgeMode;
91    elevation;
92    end;
93    exponent;
94    externalResourcesRequired;
95    fill;
96    filter;
97    filterRes;
98    filterUnits;
99    format;
100    from;
101    fr;
102    fx;
103    fy;
104    g1;
105    g2;
106    glyphRef;
107    gradientTransform;
108    gradientUnits;
109    hanging;
110    height;
111    hreflang;
112    ideographic;
113    in2;
114    intercept;
115    k;
116    k1;
117    k2;
118    k3;
119    k4;
120    kernelMatrix;
121    kernelUnitLength;
122    kerning;
123    keyPoints;
124    keySplines;
125    keyTimes;
126    lang;
127    lengthAdjust;
128    limitingConeAngle;
129    local;
130    markerHeight;
131    markerUnits;
132    markerWidth;
133    mask;
134    maskContentUnits;
135    maskUnits;
136    mathematical;
137    max;
138    media;
139    method;
140    min;
141    mode;
142    name;
143    numOctaves;
144    offset;
145    opacity;
146    operator;
147    order;
148    orient;
149    orientation;
150    origin;
151    overflow;
152    pathLength;
153    patternContentUnits;
154    patternTransform;
155    patternUnits;
156    ping;
157    points;
158    pointsAtX;
159    pointsAtY;
160    pointsAtZ;
161    preserveAlpha;
162    preserveAspectRatio;
163    primitiveUnits;
164    r;
165    radius;
166    referrerPolicy;
167    refX;
168    refY;
169    rel;
170    repeatCount;
171    repeatDur;
172    requiredExtensions;
173    requiredFeatures;
174    restart;
175    result;
176    rotate;
177    rx;
178    ry;
179    scale;
180    seed;
181    slope;
182    spacing;
183    specularConstant;
184    specularExponent;
185    speed;
186    spreadMethod;
187    startOffset;
188    stdDeviation;
189    stemh;
190    stemv;
191    stitchTiles;
192    string;
193    stroke;
194    surfaceScale;
195    systemLanguage;
196    tabindex;
197    tableValues;
198    target;
199    targetX;
200    targetY;
201    textLength;
202    to;
203    transform;
204    u1;
205    u2;
206    unicode;
207    values;
208    version;
209    viewBox;
210    viewTarget;
211    visibility;
212    width;
213    x;
214    x1;
215    x2;
216    xChannelSelector;
217    xmlns;
218    y;
219    y1;
220    y2;
221    yChannelSelector;
222    z;
223    zoomAndPan;
224}
225
226declare_svg_attributes_special! {
227    accent_height => "accent-height";
228    alignment_baseline => "alignment-baseline";
229    arabic_form => "arabic-form";
230    baseline_shift => "baseline-shift";
231    cap_height => "cap-height";
232    clip_path => "clip-path";
233    clip_rule => "clip-rule";
234    color_interpolation => "color-interpolation";
235    color_interpolation_filters => "color-interpolation-filters";
236    color_profile => "color-profile";
237    color_rendering => "color-rendering";
238    dominant_baseline => "dominant-baseline";
239    enable_background => "enable-background";
240    fill_opacity => "fill-opacity";
241    fill_rule => "fill-rule";
242    flood_color => "flood-color";
243    flood_opacity => "flood-opacity";
244    font_size_adjust => "font-size-adjust";
245    font_stretch => "font-stretch";
246    font_style => "font-style";
247    font_variant => "font-variant";
248    font_weight => "font-weight";
249    glyph_name => "glyph-name";
250    glyph_orientation_horizontal => "glyph-orientation-horizontal";
251    glyph_orientation_vertical => "glyph-orientation-vertical";
252    horiz_adv_x => "horiz-adv-x";
253    horiz_origin_x => "horiz-origin-x";
254    image_rendering => "image-rendering";
255    letter_spacing => "letter-spacing";
256    lighting_color => "lighting-color";
257    marker_end => "marker-end";
258    marker_mid => "marker-mid";
259    marker_start => "marker-start";
260    overline_position => "overline-position";
261    overline_thickness => "overline-thickness";
262    panose_1 => "panose-1";
263    paint_order => "paint-order";
264    pointer_events => "pointer-events";
265    rendering_intent => "rendering-intent";
266    shape_rendering => "shape-rendering";
267    stop_color => "stop-color";
268    stop_opacity => "stop-opacity";
269    strikethrough_position => "strikethrough-position";
270    strikethrough_thickness => "strikethrough-thickness";
271    stroke_dasharray => "stroke-dasharray";
272    stroke_dashoffset => "stroke-dashoffset";
273    stroke_linecap => "stroke-linecap";
274    stroke_linejoin => "stroke-linejoin";
275    stroke_miterlimit => "stroke-miterlimit";
276    stroke_opacity => "stroke-opacity";
277    stroke_width => "stroke-width";
278    text_anchor => "text-anchor";
279    text_decoration => "text-decoration";
280    text_rendering => "text-rendering";
281    underline_position => "underline-position";
282    underline_thickness => "underline-thickness";
283    unicode_bidi => "unicode-bidi";
284    unicode_range => "unicode-range";
285    units_per_em => "units-per-em";
286    v_alphabetic => "v-alphabetic";
287    v_hanging => "v-hanging";
288    v_ideographic => "v-ideographic";
289    v_mathematical => "v-mathematical";
290    vector_effect => "vector-effect";
291    vert_adv_y => "vert-adv-y";
292    vert_origin_x => "vert-origin-x";
293    vert_origin_y => "vert-origin-y";
294    word_spacing => "word-spacing";
295    writing_mode => "writing-mode";
296    x_height => "x-height";
297    xml_base => "xml:base";
298    xml_lang => "xml:lang";
299    xml_space => "xml:space";
300    xmlns_xlink => "xmlns:xlink";
301    r#in => "in";
302    in_ => "in";
303}
304
305declare_xlink_attributes! {
306    xlink_actuate => "actuate";
307    xlink_arcrole => "arcrole";
308    xlink_href => "href";
309    xlink_role => "role";
310    xlink_show => "show";
311    xlink_title => "title";
312    xlink_type => "type";
313}