Skip to content

Commit 55a4d16

Browse files
authored
add svg elements (#844)
* add svg elements * make snake case * Update src/idom/svg.py
1 parent 9c3c300 commit 55a4d16

File tree

3 files changed

+260
-3
lines changed

3 files changed

+260
-3
lines changed

src/idom/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from . import backend, config, html, logging, sample, types, web
1+
from . import backend, config, html, logging, sample, svg, types, web
22
from .backend.hooks import use_connection, use_location, use_scope
33
from .backend.utils import run
44
from .core import hooks
@@ -41,6 +41,7 @@
4141
"run",
4242
"sample",
4343
"Stop",
44+
"svg",
4445
"types",
4546
"use_callback",
4647
"use_connection",

src/idom/html.py

Lines changed: 118 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,124 @@
159159

160160
from typing import Any, Mapping
161161

162-
from .core.types import Key, VdomDict
163-
from .core.vdom import coalesce_attributes_and_children, make_vdom_constructor
162+
from idom.core.types import Key, VdomDict
163+
from idom.core.vdom import coalesce_attributes_and_children, make_vdom_constructor
164+
165+
166+
__all__ = (
167+
"_",
168+
"a",
169+
"abbr",
170+
"address",
171+
"area",
172+
"article",
173+
"aside",
174+
"audio",
175+
"b",
176+
"base",
177+
"bdi",
178+
"bdo",
179+
"blockquote",
180+
"body",
181+
"br",
182+
"button",
183+
"canvas",
184+
"caption",
185+
"cite",
186+
"code",
187+
"col",
188+
"colgroup",
189+
"data",
190+
"dd",
191+
"del_",
192+
"details",
193+
"dialog",
194+
"div",
195+
"dl",
196+
"dt",
197+
"em",
198+
"embed",
199+
"fieldset",
200+
"figcaption",
201+
"figure",
202+
"footer",
203+
"form",
204+
"h1",
205+
"h2",
206+
"h3",
207+
"h4",
208+
"h5",
209+
"h6",
210+
"head",
211+
"header",
212+
"hr",
213+
"i",
214+
"iframe",
215+
"img",
216+
"input",
217+
"ins",
218+
"kbd",
219+
"label",
220+
"legend",
221+
"li",
222+
"link",
223+
"main",
224+
"map",
225+
"mark",
226+
"math",
227+
"menu",
228+
"menuitem",
229+
"meta",
230+
"meter",
231+
"nav",
232+
"noscript",
233+
"object",
234+
"ol",
235+
"option",
236+
"output",
237+
"p",
238+
"param",
239+
"picture",
240+
"portal",
241+
"pre",
242+
"progress",
243+
"q",
244+
"rp",
245+
"rt",
246+
"ruby",
247+
"s",
248+
"samp",
249+
"script",
250+
"section",
251+
"select",
252+
"slot",
253+
"small",
254+
"source",
255+
"span",
256+
"strong",
257+
"style",
258+
"sub",
259+
"summary",
260+
"sup",
261+
"svg",
262+
"table",
263+
"tbody",
264+
"td",
265+
"template",
266+
"textarea",
267+
"tfoot",
268+
"th",
269+
"thead",
270+
"time",
271+
"title",
272+
"tr",
273+
"track",
274+
"u",
275+
"ul",
276+
"var",
277+
"video",
278+
"wbr",
279+
)
164280

165281

166282
def _(*children: Any, key: Key | None = None) -> VdomDict:

src/idom/svg.py

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
from idom.core.vdom import make_vdom_constructor
2+
3+
4+
__all__ = (
5+
"a",
6+
"animate",
7+
"animate_motion",
8+
"animate_transform",
9+
"circle",
10+
"clip_path",
11+
"defs",
12+
"desc",
13+
"discard",
14+
"ellipse",
15+
"fe_blend",
16+
"fe_color_matrix",
17+
"fe_component_transfer",
18+
"fe_composite",
19+
"fe_convolve_matrix",
20+
"fe_diffuse_lighting",
21+
"fe_displacement_map",
22+
"fe_distant_light",
23+
"fe_drop_shadow",
24+
"fe_flood",
25+
"fe_func_a",
26+
"fe_func_b",
27+
"fe_func_g",
28+
"fe_func_r",
29+
"fe_gaussian_blur",
30+
"fe_image",
31+
"fe_merge",
32+
"fe_merge_node",
33+
"fe_morphology",
34+
"fe_offset",
35+
"fe_point_light",
36+
"fe_specular_lighting",
37+
"fe_spot_light",
38+
"fe_tile",
39+
"fe_turbulence",
40+
"filter",
41+
"foreign_object",
42+
"g",
43+
"hatch",
44+
"hatchpath",
45+
"image",
46+
"line",
47+
"linear_gradient",
48+
"marker",
49+
"mask",
50+
"metadata",
51+
"mpath",
52+
"path",
53+
"pattern",
54+
"polygon",
55+
"polyline",
56+
"radial_gradient",
57+
"rect",
58+
"script",
59+
"set",
60+
"stop",
61+
"style",
62+
"svg",
63+
"switch",
64+
"symbol",
65+
"text",
66+
"text_path",
67+
"title",
68+
"tspan",
69+
"use",
70+
"view",
71+
)
72+
73+
a = make_vdom_constructor("a")
74+
animate = make_vdom_constructor("animate", allow_children=False)
75+
animate_motion = make_vdom_constructor("animateMotion", allow_children=False)
76+
animate_transform = make_vdom_constructor("animateTransform", allow_children=False)
77+
circle = make_vdom_constructor("circle", allow_children=False)
78+
clip_path = make_vdom_constructor("clipPath")
79+
defs = make_vdom_constructor("defs")
80+
desc = make_vdom_constructor("desc", allow_children=False)
81+
discard = make_vdom_constructor("discard", allow_children=False)
82+
ellipse = make_vdom_constructor("ellipse", allow_children=False)
83+
fe_blend = make_vdom_constructor("feBlend", allow_children=False)
84+
fe_color_matrix = make_vdom_constructor("feColorMatrix", allow_children=False)
85+
fe_component_transfer = make_vdom_constructor(
86+
"feComponentTransfer", allow_children=False
87+
)
88+
fe_composite = make_vdom_constructor("feComposite", allow_children=False)
89+
fe_convolve_matrix = make_vdom_constructor("feConvolveMatrix", allow_children=False)
90+
fe_diffuse_lighting = make_vdom_constructor("feDiffuseLighting", allow_children=False)
91+
fe_displacement_map = make_vdom_constructor("feDisplacementMap", allow_children=False)
92+
fe_distant_light = make_vdom_constructor("feDistantLight", allow_children=False)
93+
fe_drop_shadow = make_vdom_constructor("feDropShadow", allow_children=False)
94+
fe_flood = make_vdom_constructor("feFlood", allow_children=False)
95+
fe_func_a = make_vdom_constructor("feFuncA", allow_children=False)
96+
fe_func_b = make_vdom_constructor("feFuncB", allow_children=False)
97+
fe_func_g = make_vdom_constructor("feFuncG", allow_children=False)
98+
fe_func_r = make_vdom_constructor("feFuncR", allow_children=False)
99+
fe_gaussian_blur = make_vdom_constructor("feGaussianBlur", allow_children=False)
100+
fe_image = make_vdom_constructor("feImage", allow_children=False)
101+
fe_merge = make_vdom_constructor("feMerge", allow_children=False)
102+
fe_merge_node = make_vdom_constructor("feMergeNode", allow_children=False)
103+
fe_morphology = make_vdom_constructor("feMorphology", allow_children=False)
104+
fe_offset = make_vdom_constructor("feOffset", allow_children=False)
105+
fe_point_light = make_vdom_constructor("fePointLight", allow_children=False)
106+
fe_specular_lighting = make_vdom_constructor("feSpecularLighting", allow_children=False)
107+
fe_spot_light = make_vdom_constructor("feSpotLight", allow_children=False)
108+
fe_tile = make_vdom_constructor("feTile", allow_children=False)
109+
fe_turbulence = make_vdom_constructor("feTurbulence", allow_children=False)
110+
filter = make_vdom_constructor("filter", allow_children=False)
111+
foreign_object = make_vdom_constructor("foreignObject", allow_children=False)
112+
g = make_vdom_constructor("g")
113+
hatch = make_vdom_constructor("hatch", allow_children=False)
114+
hatchpath = make_vdom_constructor("hatchpath", allow_children=False)
115+
image = make_vdom_constructor("image", allow_children=False)
116+
line = make_vdom_constructor("line", allow_children=False)
117+
linear_gradient = make_vdom_constructor("linearGradient", allow_children=False)
118+
marker = make_vdom_constructor("marker")
119+
mask = make_vdom_constructor("mask")
120+
metadata = make_vdom_constructor("metadata", allow_children=False)
121+
mpath = make_vdom_constructor("mpath", allow_children=False)
122+
path = make_vdom_constructor("path", allow_children=False)
123+
pattern = make_vdom_constructor("pattern")
124+
polygon = make_vdom_constructor("polygon", allow_children=False)
125+
polyline = make_vdom_constructor("polyline", allow_children=False)
126+
radial_gradient = make_vdom_constructor("radialGradient", allow_children=False)
127+
rect = make_vdom_constructor("rect", allow_children=False)
128+
script = make_vdom_constructor("script", allow_children=False)
129+
set = make_vdom_constructor("set", allow_children=False)
130+
stop = make_vdom_constructor("stop", allow_children=False)
131+
style = make_vdom_constructor("style", allow_children=False)
132+
svg = make_vdom_constructor("svg")
133+
switch = make_vdom_constructor("switch")
134+
symbol = make_vdom_constructor("symbol")
135+
text = make_vdom_constructor("text", allow_children=False)
136+
text_path = make_vdom_constructor("textPath", allow_children=False)
137+
title = make_vdom_constructor("title", allow_children=False)
138+
tspan = make_vdom_constructor("tspan", allow_children=False)
139+
use = make_vdom_constructor("use", allow_children=False)
140+
view = make_vdom_constructor("view", allow_children=False)

0 commit comments

Comments
 (0)