-
Notifications
You must be signed in to change notification settings - Fork 0
/
tagl.js
30 lines (24 loc) · 962 Bytes
/
tagl.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.tagl = factory());
}(this, (function () { 'use strict';
function makeTag(h) {
function create(tag) {
var classes = [], len = arguments.length - 1;
while ( len-- > 0 ) classes[ len ] = arguments[ len + 1 ];
return new Proxy(function () {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
return h.apply(void 0, [ tag, classes ].concat( args ));
}, {
get: function (_, key) { return create.apply(void 0, [ tag ].concat( classes, [key] )); },
})
}
return new Proxy(function (tag) { return create(tag); }, {
get: function (comps, tag) { return create(comps[tag] || tag); },
})
}
return makeTag;
})));
//# sourceMappingURL=tagl.js.map