Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var elm = require('elm');
var EXPAND_BOTH = { x: 1.0, y: 1.0 };
var FILL_BOTH = { x: -1.0, y: -1.0 };
function select_cb(widget, label) {
print(label);
if (!label) // undefined
widget.label = "Go";
else
widget.label = label;
}
var w = elm.Window({
title: "ActionSlider example",
width: 320,
height: 480,
elements: {
the_background: elm.Background({
weight: EXPAND_BOTH,
resize: true,
}),
the_box: elm.Box({
weight: { x: 1.0, y: 0.0 },
resize: true,
elements: {
snooze_right: elm.ActionSlider({
weight: { x: 1.0, y: 0.0 },
align: { x: -1.0, y: 0.0 },
labels: { left: "Snooze", right: "Stop" },
file: elm.datadir + 'data/images/bubble_' + type + '.png',
on_animate: function(arg) {
animator(arg, n, type == 'sh');
}
});
}
function bubble(n) {
return sprite(n, 'bb');
}
function shadow(n) {
return sprite(n, 'sh');
}
var win = elm.realise(elm.Window({
label: "Animation demo",
width: 480,
height: 800,
elements: {
the_background: elm.Background({
weight: EXPAND_BOTH,
image: elm.datadir + "data/images/rock_01.jpg",
resize: true
}),
shadow1: shadow(0),
shadow2: shadow(1),
shadow3: shadow(2),
bubble1: bubble(0),
bubble2: bubble(1),
bubble3: bubble(2)
},
elm = require('elm');
var EXPAND_BOTH = { x: 1.0, y: 1.0 };
var FILL_BOTH = { x: -1.0, y: -1.0 };
var logo_icon = elm.Icon({
image: elm.datadir + "data/images/logo_small.png",
});
var logo_icon_unscaled = elm.Icon({
image: elm.datadir + "data/images/logo_small.png",
resizable_up: false,
resizable_down: false,
});
var window = elm.Window({
label: "Segment Control demo",
elements: {
background: elm.Background({
weight: EXPAND_BOTH,
resize: true,
}),
segment: elm.Segment({
weight: { x: 1, y: 0 },
resize: true,
items: {
foo: {
label: "Only Text",
},
1: {
icon: logo_icon,
},
var elm = require('elm');
var EXPAND_BOTH = { x: 1.0, y: 1.0 };
var FILL_BOTH = { x: -1.0, y: -1.0 };
var logo_icon = elm.Icon({
image: elm.datadir + "data/images/logo_small.png"
});
var logo_icon_unscaled = elm.Icon({
image: elm.datadir + "data/images/logo_small.png",
resizable_up: false,
resizable_down: false
});
var w = elm.Window({
title: "Check box demo",
elements: {
the_background: elm.Background({
weight: EXPAND_BOTH,
resize: true
}),
the_box: elm.Box({
weight: EXPAND_BOTH,
resize: true,
elements: {
icon_sized_check: elm.Check({
icon: logo_icon,
label: "Icon sized to check",
weight: { x: -1.0, y: -1.0 },
align: { x: -1.0, y: 0.5 },
state: true
"Also (size + ascent): " +
"" +
" (full) " +
"" +
" (before this)<br>" +
"And as well (absize + ascent): " +
"" +
" (full) " +
"" +
" or even paths to image files on disk too like: " +
"" +
" ... end.";
var w = elm.Window({
label: "Entry",
width: 320,
height: 480,
weight: EXPAND_BOTH,
align: FILL_BOTH,
elements: {
the_background: elm.Background({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true
}),
the_box: elm.Box({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true,
elements: {
var EXPAND_BOTH = { x: 1.0, y: 1.0 };
var FILL_BOTH = { x: -1.0, y: -1.0 };
var entry_text = "This is an entry widget in this window.";
var entry = elm.Entry({
text: entry_text,
weight: EXPAND_BOTH,
align: FILL_BOTH,
line_wrap: 3,
single_line: 1,
editable: true
});
var win = elm.realise(elm.Window({
title: "Notify Example",
width: 320,
height: 480,
weight: EXPAND_BOTH,
align: FILL_BOTH,
elements: {
background: elm.Background({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true
}),
box: elm.Box({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true,
elements: {
var elm = require('elm');
var EXPAND_BOTH = { x: 1.0, y: 1.0 };
var FILL_BOTH = { x: -1.0, y: -1.0 };
var w = elm.Window({
title: "Colour Selector Demo",
width: 320,
height: 480,
align: FILL_BOTH,
elements: {
the_background: elm.Background({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true
}),
the_box: elm.Box({
weight: EXPAND_BOTH,
resize: true,
elements: {
the_colorselector: elm.ColorSelector({
weight: EXPAND_BOTH,
var elm = require('elm');
var EXPAND_BOTH = { x: 1.0, y: 1.0 };
var FILL_BOTH = { x: -1.0, y: -1.0 };
var FILL_X = { x: -1.0, y: 0.5 };
var w = elm.Window({
title: "Spinner Demo",
width: 320,
height: 480,
align: FILL_BOTH,
elements: {
the_background: elm.Background({
weight: EXPAND_BOTH,
align: FILL_BOTH,
resize: true,
}),
the_box: elm.Box({
weight: EXPAND_BOTH,
resize: true,
elements: {
the_spinner: elm.Spinner({
label_format: "%1.1f units",