@pfern/elements 0.1.11 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/svg.js ADDED
@@ -0,0 +1,407 @@
1
+ import { elements } from './core/elements.js'
2
+
3
+ /**
4
+ * SVG tag helpers.
5
+ *
6
+ * Like `src/html.js`, this module stays intentionally “flat”: one named export
7
+ * per SVG element with a short description for editor-first documentation.
8
+ */
9
+
10
+ /**
11
+ * The <animate> SVG element provides a way to animate an attribute of an element over time.
12
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/animate
13
+ *
14
+ */
15
+ export const animate = elements.animate
16
+
17
+ /**
18
+ * The <animateMotion> SVG element provides a way to define how an element moves along a motion path.
19
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/animateMotion
20
+ *
21
+ */
22
+ export const animateMotion = elements.animateMotion
23
+
24
+ /**
25
+ * The <animateTransform> SVG element animates a transformation attribute on its target element, thereby allowing animations to control translation, scaling, rotation, and/or skewing.
26
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/animateTransform
27
+ *
28
+ */
29
+ export const animateTransform = elements.animateTransform
30
+
31
+ /**
32
+ * The <mpath> SVG sub-element for the <animateMotion> element provides the ability to reference an external <path> element as the definition of a motion path.
33
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/mpath
34
+ *
35
+ */
36
+ export const mpath = elements.mpath
37
+
38
+ /**
39
+ * The <set> SVG element provides a method of setting the value of an attribute for a specified duration.
40
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/set
41
+ *
42
+ */
43
+ export const set = elements.set
44
+
45
+ /**
46
+ * The <circle> SVG element is an SVG basic shape, used to draw circles based on a center point and a radius.
47
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/circle
48
+ *
49
+ */
50
+ export const circle = elements.circle
51
+
52
+ /**
53
+ * The <ellipse> SVG element is an SVG basic shape, used to create ellipses based on a center coordinate, and both their x and y radius.
54
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/ellipse
55
+ *
56
+ */
57
+ export const ellipse = elements.ellipse
58
+
59
+ /**
60
+ * The <line> SVG element is an SVG basic shape used to create a line connecting two points.
61
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/line
62
+ *
63
+ */
64
+ export const line = elements.line
65
+
66
+ /**
67
+ * The <path> SVG element is the generic element to define a shape. All the basic shapes can be created with a path element.
68
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/path
69
+ *
70
+ */
71
+ export const path = elements.path
72
+
73
+ /**
74
+ * The <polygon> SVG element defines a closed shape consisting of a set of connected straight line segments. The last point is connected to the first point.
75
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/polygon
76
+ *
77
+ */
78
+ export const polygon = elements.polygon
79
+
80
+ /**
81
+ * The <polyline> SVG element is an SVG basic shape that creates straight lines connecting several points. Typically a polyline is used to create open shapes as the last point doesn't have to be connected to the first point. For closed shapes see the <polygon> element.
82
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/polyline
83
+ *
84
+ */
85
+ export const polyline = elements.polyline
86
+
87
+ /**
88
+ * The <rect> SVG element is a basic SVG shape that draws rectangles, defined by their position, width, and height. The rectangles may have their corners rounded.
89
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/rect
90
+ *
91
+ */
92
+ export const rect = elements.rect
93
+
94
+ /**
95
+ * The <defs> SVG element is used to store graphical objects that will be used at a later time. Objects created inside a <defs> element are not rendered directly. To display them you have to reference them (with a <use> element for example).
96
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/defs
97
+ *
98
+ */
99
+ export const defs = elements.defs
100
+
101
+ /**
102
+ * The <g> SVG element is a container used to group other SVG elements.
103
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/g
104
+ *
105
+ */
106
+ export const g = elements.g
107
+
108
+ /**
109
+ * The <marker> SVG element defines a graphic used for drawing arrowheads or polymarkers on a given <path>, <line>, <polyline> or <polygon> element.
110
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/marker
111
+ *
112
+ */
113
+ export const marker = elements.marker
114
+
115
+ /**
116
+ * The <mask> SVG element defines a mask for compositing the current object into the background. A mask is used/referenced using the mask property and CSS mask-image property.
117
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/mask
118
+ *
119
+ */
120
+ export const mask = elements.mask
121
+
122
+ /**
123
+ * The <pattern> SVG element defines a graphics object which can be redrawn at repeated x- and y-coordinate intervals ("tiled") to cover an area.
124
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/pattern
125
+ *
126
+ */
127
+ export const pattern = elements.pattern
128
+
129
+ /**
130
+ * The <svg> SVG element is a container that defines a new coordinate system and viewport. It is used as the outermost element of SVG documents, but it can also be used to embed an SVG fragment inside an SVG or HTML document.
131
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/svg
132
+ *
133
+ */
134
+ export const svg = elements.svg
135
+
136
+ /**
137
+ * The <switch> SVG element evaluates any requiredFeatures, requiredExtensions and systemLanguage attributes on its direct child elements in order, and then renders the first child where these attributes evaluate to true.
138
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/switch
139
+ *
140
+ */
141
+ export const svgswitch = elements.switch
142
+
143
+ /**
144
+ * The <symbol> SVG element is used to define graphical template objects which can be instantiated by a <use> element.
145
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/symbol
146
+ *
147
+ */
148
+ export const symbol = elements.symbol
149
+
150
+ /**
151
+ * The <use> element takes nodes from within an SVG document, and duplicates them somewhere else. The effect is the same as if the nodes were deeply cloned into a non-exposed DOM, then pasted where the <use> element is, much like cloned <template> elements.
152
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/use
153
+ *
154
+ */
155
+ export const use = elements.use
156
+
157
+ /**
158
+ * The <desc> SVG element provides an accessible, long-text description of any SVG container element or graphics element.
159
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/desc
160
+ *
161
+ */
162
+ export const desc = elements.desc
163
+
164
+ /**
165
+ * The <metadata> SVG element adds metadata to SVG content. Metadata is structured information about data. The contents of <metadata> should be elements from other XML namespaces such as RDF, FOAF, etc.
166
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/metadata
167
+ *
168
+ */
169
+ export const metadata = elements.metadata
170
+
171
+ /**
172
+ * The <filter> SVG element defines a custom filter effect by grouping atomic filter primitives. It is never rendered itself, but must be used by the filter attribute on SVG elements, or the filter CSS property for SVG/HTML elements.
173
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/filter
174
+ *
175
+ */
176
+ export const filter = elements.filter
177
+
178
+ /**
179
+ * The <feBlend> SVG filter primitive composes two objects together ruled by a certain blending mode. This is similar to what is known from image editing software when blending two layers. The mode is defined by the mode attribute.
180
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feBlend
181
+ *
182
+ */
183
+ export const feBlend = elements.feBlend
184
+
185
+ /**
186
+ * The <feColorMatrix> SVG filter element changes colors based on a transformation matrix. Every pixel's color value [R,G,B,A] is matrix multiplied by a 5 by 5 color matrix to create new color [R',G',B',A'].
187
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feColorMatrix
188
+ *
189
+ */
190
+ export const feColorMatrix = elements.feColorMatrix
191
+
192
+ /**
193
+ * The <feComponentTransfer> SVG filter primitive performs color-component-wise remapping of data for each pixel. It allows operations like brightness adjustment, contrast adjustment, color balance or thresholding.
194
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feComponentTransfer
195
+ *
196
+ */
197
+ export const feComponentTransfer = elements.feComponentTransfer
198
+
199
+ /**
200
+ * The <feComposite> SVG filter primitive performs the combination of two input images pixel-wise in image space using one of the Porter-Duff compositing operations: over, in, atop, out, xor, lighter, or arithmetic.
201
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feComposite
202
+ *
203
+ */
204
+ export const feComposite = elements.feComposite
205
+
206
+ /**
207
+ * The <feConvolveMatrix> SVG filter primitive applies a matrix convolution filter effect. A convolution combines pixels in the input image with neighboring pixels to produce a resulting image. A wide variety of imaging operations can be achieved through convolutions, including blurring, edge detection, sharpening, embossing and beveling.
208
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feConvolveMatrix
209
+ *
210
+ */
211
+ export const feConvolveMatrix = elements.feConvolveMatrix
212
+
213
+ /**
214
+ * The <feDiffuseLighting> SVG filter primitive lights an image using the alpha channel as a bump map. The resulting image, which is an RGBA opaque image, depends on the light color, light position and surface geometry of the input bump map.
215
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feDiffuseLighting
216
+ *
217
+ */
218
+ export const feDiffuseLighting = elements.feDiffuseLighting
219
+
220
+ /**
221
+ * The <feDisplacementMap> SVG filter primitive uses the pixel values from the image from in2 to spatially displace the image from in.
222
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feDisplacementMap
223
+ *
224
+ */
225
+ export const feDisplacementMap = elements.feDisplacementMap
226
+
227
+ /**
228
+ * The <feDistantLight> SVG filter primitive defines a distant light source that can be used within a lighting filter primitive: <feDiffuseLighting> or <feSpecularLighting>.
229
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feDistantLight
230
+ *
231
+ */
232
+ export const feDistantLight = elements.feDistantLight
233
+
234
+ /**
235
+ * The <feDropShadow> SVG filter primitive creates a drop shadow of the input image. It can only be used inside a <filter> element.
236
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feDropShadow
237
+ *
238
+ */
239
+ export const feDropShadow = elements.feDropShadow
240
+
241
+ /**
242
+ * The <feFlood> SVG filter primitive fills the filter subregion with the color and opacity defined by flood-color and flood-opacity.
243
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feFlood
244
+ *
245
+ */
246
+ export const feFlood = elements.feFlood
247
+
248
+ /**
249
+ * The <feFuncA> SVG filter primitive defines the transfer function for the alpha component of the input graphic of its parent <feComponentTransfer> element.
250
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feFuncA
251
+ *
252
+ */
253
+ export const feFuncA = elements.feFuncA
254
+
255
+ /**
256
+ * The <feFuncB> SVG filter primitive defines the transfer function for the blue component of the input graphic of its parent <feComponentTransfer> element.
257
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feFuncB
258
+ *
259
+ */
260
+ export const feFuncB = elements.feFuncB
261
+
262
+ /**
263
+ * The <feFuncG> SVG filter primitive defines the transfer function for the green component of the input graphic of its parent <feComponentTransfer> element.
264
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feFuncG
265
+ *
266
+ */
267
+ export const feFuncG = elements.feFuncG
268
+
269
+ /**
270
+ * The <feFuncR> SVG filter primitive defines the transfer function for the red component of the input graphic of its parent <feComponentTransfer> element.
271
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feFuncR
272
+ *
273
+ */
274
+ export const feFuncR = elements.feFuncR
275
+
276
+ /**
277
+ * The <feGaussianBlur> SVG filter primitive blurs the input image by the amount specified in stdDeviation, which defines the bell-curve.
278
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feGaussianBlur
279
+ *
280
+ */
281
+ export const feGaussianBlur = elements.feGaussianBlur
282
+
283
+ /**
284
+ * The <feImage> SVG filter primitive fetches image data from an external source and provides the pixel data as output (meaning if the external source is an SVG image, it is rasterized.)
285
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feImage
286
+ *
287
+ */
288
+ export const feImage = elements.feImage
289
+
290
+ /**
291
+ * The <feMerge> SVG element allows filter effects to be applied concurrently instead of sequentially. This is achieved by other filters storing their output via the result attribute and then accessing it in a <feMergeNode> child.
292
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feMerge
293
+ *
294
+ */
295
+ export const feMerge = elements.feMerge
296
+
297
+ /**
298
+ * The <feMergeNode> SVG takes the result of another filter to be processed by its parent <feMerge>.
299
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feMergeNode
300
+ *
301
+ */
302
+ export const feMergeNode = elements.feMergeNode
303
+
304
+ /**
305
+ * The <feMorphology> SVG filter primitive is used to erode or dilate the input image. Its usefulness lies especially in fattening or thinning effects.
306
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feMorphology
307
+ *
308
+ */
309
+ export const feMorphology = elements.feMorphology
310
+
311
+ /**
312
+ * The <feOffset> SVG filter primitive enables offsetting an input image relative to its current position. The input image as a whole is offset by the values specified in the dx and dy attributes.
313
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feOffset
314
+ *
315
+ */
316
+ export const feOffset = elements.feOffset
317
+
318
+ /**
319
+ * The <fePointLight> SVG filter primitive defines a light source which allows to create a point light effect. It that can be used within a lighting filter primitive: <feDiffuseLighting> or <feSpecularLighting>.
320
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/fePointLight
321
+ *
322
+ */
323
+ export const fePointLight = elements.fePointLight
324
+
325
+ /**
326
+ * The <feSpecularLighting> SVG filter primitive lights a source graphic using the alpha channel as a bump map. The resulting image is an RGBA image based on the light color. The lighting calculation follows the standard specular component of the Phong lighting model. The resulting image depends on the light color, light position and surface geometry of the input bump map. The result of the lighting calculation is added. The filter primitive assumes that the viewer is at infinity in the z direction.
327
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feSpecularLighting
328
+ *
329
+ */
330
+ export const feSpecularLighting = elements.feSpecularLighting
331
+
332
+ /**
333
+ * The <feSpotLight> SVG filter primitive defines a light source that can be used to create a spotlight effect. It is used within a lighting filter primitive: <feDiffuseLighting> or <feSpecularLighting>.
334
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feSpotLight
335
+ *
336
+ */
337
+ export const feSpotLight = elements.feSpotLight
338
+
339
+ /**
340
+ * The <feTile> SVG filter primitive allows to fill a target rectangle with a repeated, tiled pattern of an input image. The effect is similar to the one of a <pattern>.
341
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feTile
342
+ *
343
+ */
344
+ export const feTile = elements.feTile
345
+
346
+ /**
347
+ * The <feTurbulence> SVG filter primitive creates an image using the Perlin turbulence function. It allows the synthesis of artificial textures like clouds or marble. The resulting image will fill the entire filter primitive subregion.
348
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/feTurbulence
349
+ *
350
+ */
351
+ export const feTurbulence = elements.feTurbulence
352
+
353
+ /**
354
+ * The <linearGradient> SVG element lets authors define linear gradients to apply to other SVG elements.
355
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/linearGradient
356
+ *
357
+ */
358
+ export const linearGradient = elements.linearGradient
359
+
360
+ /**
361
+ * The <radialGradient> SVG element lets authors define radial gradients that can be applied to fill or stroke of graphical elements.
362
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/radialGradient
363
+ *
364
+ */
365
+ export const radialGradient = elements.radialGradient
366
+
367
+ /**
368
+ * The <stop> SVG element defines a color and its position to use on a gradient. This element is always a child of a <linearGradient> or <radialGradient> element.
369
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/stop
370
+ *
371
+ */
372
+ export const stop = elements.stop
373
+
374
+ /**
375
+ * The <foreignObject> SVG element includes elements from a different XML namespace. In the context of a browser, it is most likely (X)HTML.
376
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/foreignObject
377
+ *
378
+ */
379
+ export const foreignObject = elements.foreignObject
380
+
381
+ /**
382
+ * The <text> SVG element draws a graphics element consisting of text. It's possible to apply a gradient, pattern, clipping path, mask, or filter to <text>, like any other SVG graphics element.
383
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/text
384
+ *
385
+ */
386
+ export const text = elements.text
387
+
388
+ /**
389
+ * The <textPath> SVG element is used to render text along the shape of a <path> element. The text must be enclosed in the <textPath> element and its href attribute is used to reference the desired <path>.
390
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/textPath
391
+ *
392
+ */
393
+ export const textPath = elements.textPath
394
+
395
+ /**
396
+ * The <tspan> SVG element defines a subtext within a <text> element or another <tspan> element. It allows for adjustment of the style and/or position of that subtext as needed.
397
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/tspan
398
+ *
399
+ */
400
+ export const tspan = elements.tspan
401
+
402
+ /**
403
+ * The <view> SVG element defines a particular view of an SVG document. A specific view can be displayed by referencing the <view> element's id as the target fragment of a URL.
404
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/view
405
+ *
406
+ */
407
+ export const view = elements.view