UNPKG

7.47 kBPlain TextView Raw
1import * as m from 'mithril';
2
3export const Compote = m;
4
5/** HTML */
6// http://www.quackit.com/html_5/tags
7export const a = tag('a');
8export const abbr = tag('abbr');
9export const acronym = tag('acronym');
10export const address = tag('address');
11export const applet = tag('applet');
12export const area = tag('area');
13export const article = tag('article');
14export const aside = tag('aside');
15export const audio = tag('audio');
16export const b = tag('b');
17export const base = tag('base');
18export const basefont = tag('basefont');
19export const bdo = tag('bdo');
20export const big = tag('big');
21export const blockquote = tag('blockquote');
22export const body = tag('body');
23export const br = tag('br');
24export const button = tag('button');
25export const canvas = tag('canvas');
26export const caption = tag('caption');
27export const center = tag('center');
28export const circle = tag('circle');
29export const cite = tag('cite');
30export const clippath = tag('clippath');
31export const code = tag('code');
32export const col = tag('col');
33export const colgroup = tag('colgroup');
34// export const data = tag('data');
35export const datalist = tag('datalist');
36export const dd = tag('dd');
37export const defs = tag('defs');
38export const del = tag('del');
39export const desc = tag('desc');
40export const dfn = tag('dfn');
41export const dir = tag('dir');
42export const div = tag('div');
43export const dl = tag('dl');
44export const dt = tag('dt');
45export const ellipse = tag('ellipse');
46export const em = tag('em');
47export const embed = tag('embed');
48export const feblend = tag('feblend');
49export const fecolormatrix = tag('fecolormatrix');
50export const fecomponenttransfer = tag('fecomponenttransfer');
51export const fecomposite = tag('fecomposite');
52export const feconvolvematrix = tag('feconvolvematrix');
53export const fediffuselighting = tag('fediffuselighting');
54export const fedisplacementmap = tag('fedisplacementmap');
55export const fedistantlight = tag('fedistantlight');
56export const feflood = tag('feflood');
57export const fefunca = tag('fefunca');
58export const fefuncb = tag('fefuncb');
59export const fefuncg = tag('fefuncg');
60export const fefuncr = tag('fefuncr');
61export const fegaussianblur = tag('fegaussianblur');
62export const feimage = tag('feimage');
63export const femerge = tag('femerge');
64export const femergenode = tag('femergenode');
65export const femorphology = tag('femorphology');
66export const feoffset = tag('feoffset');
67export const fepointlight = tag('fepointlight');
68export const fespecularlighting = tag('fespecularlighting');
69export const fespotlight = tag('fespotlight');
70export const fetile = tag('fetile');
71export const feturbulence = tag('feturbulence');
72export const fieldset = tag('fieldset');
73export const figcaption = tag('figcaption');
74export const figure = tag('figure');
75export const filter = tag('filter');
76export const font = tag('font');
77export const footer = tag('footer');
78export const foreignobject = tag('foreignobject');
79export const form = tag('form');
80export const frame = tag('frame');
81export const frameset = tag('frameset');
82export const g = tag('g');
83export const h1 = tag('h1');
84export const h2 = tag('h2');
85export const h3 = tag('h3');
86export const h4 = tag('h4');
87export const h5 = tag('h5');
88export const h6 = tag('h6');
89export const head = tag('head');
90export const header = tag('header');
91export const hgroup = tag('hgroup');
92export const hr = tag('hr');
93export const html = tag('html');
94export const i = tag('i');
95export const iframe = tag('iframe');
96export const image = tag('image');
97export const img = tag('img');
98export const input = tag('input');
99export const ins = tag('ins');
100export const isindex = tag('isindex');
101export const kbd = tag('kbd');
102export const keygen = tag('keygen');
103export const label = tag('label');
104export const legend = tag('legend');
105export const li = tag('li');
106export const line = tag('line');
107export const lineargradient = tag('lineargradient');
108export const link = tag('link');
109export const listing = tag('listing');
110export const map = tag('map');
111export const mark = tag('mark');
112export const marker = tag('marker');
113export const marquee = tag('marquee');
114export const mask = tag('mask');
115export const menu = tag('menu');
116export const meta = tag('meta');
117export const metadata = tag('metadata');
118export const meter = tag('meter');
119export const nav = tag('nav');
120export const nextid = tag('nextid');
121export const nobr = tag('nobr');
122export const noframes = tag('noframes');
123export const noscript = tag('noscript');
124export const object = tag('object');
125export const ol = tag('ol');
126export const optgroup = tag('optgroup');
127export const option = tag('option');
128// export const output = tag('output');
129export const p = tag('p');
130export const param = tag('param');
131export const path = tag('path');
132export const pattern = tag('pattern');
133export const picture = tag('picture');
134export const plaintext = tag('plaintext');
135export const polygon = tag('polygon');
136export const polyline = tag('polyline');
137export const pre = tag('pre');
138export const progress = tag('progress');
139export const q = tag('q');
140export const radialgradient = tag('radialgradient');
141export const rect = tag('rect');
142export const rt = tag('rt');
143export const ruby = tag('ruby');
144export const s = tag('s');
145export const samp = tag('samp');
146export const script = tag('script');
147export const section = tag('section');
148export const select = tag('select');
149export const small = tag('small');
150export const source = tag('source');
151export const span = tag('span');
152export const stop = tag('stop');
153export const strike = tag('strike');
154export const strong = tag('strong');
155export const style = tag('style');
156export const sub = tag('sub');
157export const sup = tag('sup');
158export const svg = tag('svg');
159// export const switch = tag('switch');
160export const symbol = tag('symbol');
161export const table = tag('table');
162export const tbody = tag('tbody');
163export const td = tag('td');
164export const template = tag('template');
165export const text = tag('text');
166export const textpath = tag('textpath');
167export const textarea = tag('textarea');
168export const tfoot = tag('tfoot');
169export const th = tag('th');
170export const thead = tag('thead');
171// export const time = tag('time');
172export const title = tag('title');
173export const tr = tag('tr');
174export const track = tag('track');
175export const tspan = tag('tspan');
176export const tt = tag('tt');
177export const u = tag('u');
178export const ul = tag('ul');
179export const use = tag('use');
180// export const var = tag('var');
181export const video = tag('video');
182export const view = tag('view');
183export const wbr = tag('wbr');
184// export const x-ms-webview = tag('webview');
185export const xmp = tag('xmp');
186
187export function tag<TagNameType extends keyof ElementTagNameMap, ElementType extends ElementTagNameMap[TagNameType]>(tagName: TagNameType) {
188 return function (properties?: CustomProperties & RecursivePartial<ElementType>, children?: m.Children) {
189 return Compote(tagName, properties, children);
190 };
191}
192
193export type RecursivePartial<T> = {
194 [P in keyof T]?: RecursivePartial<T[P]>;
195};
196
197type CustomProperties = {
198 key?: number | string;
199
200 oninit?(node?: ComponentNode): void;
201 oncreate?(node?: ComponentNode): void;
202
203 onbeforeupdate?(newNode?: ComponentNode, oldNode?: ComponentNode): void | boolean;
204 onupdate?(node?: ComponentNode): void;
205
206 onbeforeremove?(node?: ComponentNode): void | Promise<any>;
207 onremove?(node?: ComponentNode): void;
208};
209
210export type ComponentNode = m.Vnode<any, any> & { dom: HTMLElement };