maquette-bulma/bulma.js

104 lines
3.7 KiB
JavaScript
Raw Normal View History

2020-01-03 10:09:45 +01:00
// Generated by LiveScript 1.6.0
(function(){
2020-01-04 11:37:30 +01:00
var h, alias;
2020-01-03 10:09:45 +01:00
h = require('maquette').h;
2020-01-04 11:37:30 +01:00
alias = function(baseSelector){
return function(selector, args, children){
if (typeof selector === "object") {
children = args;
args = selector;
selector = "";
}
return h(baseSelector + selector, args, children);
};
};
2020-01-03 10:09:45 +01:00
module.exports = {
2020-01-04 11:37:30 +01:00
container: alias('div.container'),
footer: alias('footer.footer'),
2020-01-05 06:14:27 +01:00
columns: alias('div.columns'),
column: alias('div.column'),
2020-01-03 10:09:45 +01:00
box: function(args, children){
return h('div.box', args, children);
},
title: function(level, args, label){
if (!label) {
label = args;
args = {};
}
return h("div.title.is-" + level, args, [label]);
},
label: function(args, label){
if (!label) {
label = args;
args = {};
}
return h('label.label', args, [label]);
},
input: function(args, children){
return h('input.input', args, children);
},
textarea: function(args, children){
return h('textarea.textarea', args, children);
},
2020-01-04 11:37:30 +01:00
control: alias('div.control'),
button: alias('div.button'),
tag: alias('div.tag'),
2020-01-03 10:09:45 +01:00
select: function(selector, args, children){
if (typeof selector === "object") {
children = args;
args = selector;
selector = "";
}
return h('div.select' + selector, {}, [h('select', {
onchange: args.onchange || function(){}
}, children)]);
},
field: function(selector, args, children){
if (typeof selector === "object") {
children = args;
args = selector;
selector = "";
}
return h('div.field' + selector, args, children);
},
form: function(method, url, content){
return h('form.form', {
action: url,
method: method
}, content);
},
media: function(args){
return h('div.media', [args.left ? h('div.media-left', args.left) : void 8, args.content ? h('div.media-content', args.content) : void 8, args.right ? h('div.media-right', args.right) : void 8]);
},
level: function(args){
return h('div.level', [args.left ? h('div.level-left', args.left) : void 8, args.right ? h('div.level-right', args.right) : void 8]);
2020-01-04 11:37:30 +01:00
},
navbar: function(args){
var useContainer, classes, innerNavbar;
args || (args = {});
useContainer = args.useContainer || false;
classes = args.classes || {};
2020-01-04 11:37:30 +01:00
innerNavbar = function(){
var start, end;
return [args.brand ? h('div.navbar-brand', args.brand) : void 8, args.start || args.end ? h('div.navbar-menu', [(start = args.start) ? h('div.navbar-start', start) : void 8, (end = args.end) ? h('div.navbar-end', end) : void 8]) : void 8];
};
return h('nav.navbar', {
classes: classes
}, [useContainer
? h('div.container', innerNavbar())
: innerNavbar()]);
},
2020-01-07 07:42:08 +01:00
navbarItem: alias('a.navbar-item'),
hero: function(args){
var head, body, footer;
args || (args = {});
return h('div.hero', args, [(head = args.head) ? h('div.hero-head', head) : void 8, (body = args.body) ? h('div.hero-body', body) : void 8, (footer = args.footer) ? h('div.hero-footer', footer) : void 8]);
2020-01-07 07:42:24 +01:00
},
card: function(args){
var header, title, icon, content, footer;
args || (args = {});
return h('div.card', args, [(header = args.header) ? h('div.card-header', [(title = header.title) ? h('div.card-header-title', [title]) : void 8, (icon = header.icon) ? h('div.card-header-icon', [icon]) : void 8]) : void 8, (content = args.content) ? h('div.card-content', content) : void 8, (footer = args.footer) ? h('div.card-footer', footer) : void 8]);
2020-01-07 07:42:08 +01:00
}
2020-01-03 10:09:45 +01:00
};
}).call(this);