// see JSPanel.de sclass JSPanel { new LS headStuff; LS defaultIconFont; sclass HeaderControls { Map add; S smallify; // e.g. "remove" Map asMap() { ret mapValues_withoutNulls nullIfEmpty_gen(litorderedmap( +add, +smallify )); } } class Options { S headerTitle = null; new LS contents; // HTML content S theme; // e.g. "info" S overflow; // e.g. "hidden" S border; // e.g. "thick dashed orange" HeaderControls headerControls; LS iconfont = defaultIconFont; Map asMap() { ret mapValues_withoutNulls nullIfEmpty_gen(litorderedmap( +headerTitle, content := lines_rtrim(contents), +theme, +overflow, +border, headerControls := headerControls?.asMap(), +iconfont, )); } HeaderControls headerControls() { ret headerControls == null ? (headerControls = new HeaderControls) : headerControls; } } Options newOptions() { ret new Options; } *() { smallerControls(); } void smallerControls() { setAdd(headStuff, hcss([[ /* CSS for custom controls */ .custom-control-icon.custom-smallify::before{ content: "\025B4"; /*content: url(../../images/close16x16.png);*/ } .custom-control-icon.custom-minimize::before { content: "\0268A"; } .custom-control-icon.custom-normalize::before{ content: "\02750"; } .custom-control-icon.custom-maximize::before{ content: "\02610"; } .custom-control-icon.custom-close::before{ content: "\02715"; } ]])); defaultIconFont = splitAtSpace("custom-smallify custom-minimize custom-normalize custom-maximize custom-close"); } // expression to create this panel JS createPanel(Options options default null) { ret JS("jsPanel.create($options)", options := or(options, newOptions()).asMap()); } S headStuff() { ret nemptyLines_flattenLists( hlink("https://cdn.jsdelivr.net/npm/jspanel4@4.12.0/dist/jspanel.css"), hlink("https://cdn.jsdelivr.net/npm/jspanel4@4.12.0/dist/jspanel.js"), headStuff); } ifdef guggida /* */ endifdef }