-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathnode.js
More file actions
22 lines (16 loc) · 727 Bytes
/
Copy pathnode.js
File metadata and controls
22 lines (16 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*! (c) Andrea Giammarchi - MIT */
import create from './creator.js';
import parser from './parser.js';
import render from './render/node.js';
import { attr } from './handler.js';
/** @typedef {import("./literals.js").DOMValue} DOMValue */
/** @typedef {import("./literals.js").Target} Target */
const tag = svg => {
const parse = create(parser(svg));
return (template, ...values) => parse(template, values).n;
};
/** @type {(template: TemplateStringsArray, ...values:DOMValue[]) => Target} A tag to render HTML content. */
const html = tag(false);
/** @type {(template: TemplateStringsArray, ...values:DOMValue[]) => Target} A tag to render SVG content. */
const svg = tag(true);
export { render, html, svg, attr };