2022-05-12 23:22:49 +02:00
|
|
|
import sl_css from '@shoelace-style/shoelace/dist/themes/light.styles.js';
|
|
|
|
import {css} from "lit";
|
|
|
|
|
2022-05-13 19:51:29 +02:00
|
|
|
import {registerIconLibrary} from '@shoelace-style/shoelace/dist/utilities/icon-library.js';
|
|
|
|
import {egw} from "../../jsapi/egw_global";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This makes sure the built-in icons can be found
|
|
|
|
*/
|
|
|
|
registerIconLibrary('default', {
|
2022-06-08 00:39:04 +02:00
|
|
|
resolver: name =>
|
|
|
|
{
|
|
|
|
return typeof egw !== "undefined" ? `${egw.webserverUrl}/node_modules/@shoelace-style/shoelace/dist/assets/icons/${name}.svg` : ''
|
|
|
|
},
|
2022-05-13 19:51:29 +02:00
|
|
|
});
|
|
|
|
|
2022-05-27 22:12:31 +02:00
|
|
|
/**
|
2022-05-27 23:39:51 +02:00
|
|
|
* Override some shoelace icons with EGroupware icons
|
|
|
|
* In particular, the data: ones give errors with our CSP
|
2022-05-31 01:05:00 +02:00
|
|
|
* hacky hack to temporarily work around until CSP issue is fixed
|
|
|
|
*
|
|
|
|
* @see https://my.egroupware.org/egw/index.php?menuaction=tracker.tracker_ui.edit&tr_id=68774
|
2022-05-27 22:12:31 +02:00
|
|
|
*/
|
2022-06-01 17:26:12 +02:00
|
|
|
const egw_icons = {'chevron-down': 'arrow_down', 'x': 'close', 'x-circle-fill': 'close'}
|
2022-05-27 22:12:31 +02:00
|
|
|
registerIconLibrary("system", {
|
|
|
|
resolver: (name) =>
|
|
|
|
{
|
2022-06-08 00:39:04 +02:00
|
|
|
if(egw_icons[name] && egw)
|
2022-05-27 22:12:31 +02:00
|
|
|
{
|
|
|
|
return `${egw.webserverUrl}/pixelegg/images/${egw_icons[name]}.svg`;
|
|
|
|
}
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2022-05-12 23:22:49 +02:00
|
|
|
/**
|
|
|
|
* Customise shoelace styles to match our stuff
|
2022-05-13 19:51:29 +02:00
|
|
|
* External CSS will override this
|
2022-05-12 23:22:49 +02:00
|
|
|
*/
|
|
|
|
export default [sl_css, css`
|
|
|
|
:root,
|
|
|
|
:host,
|
|
|
|
.sl-theme-light {
|
2022-05-26 22:47:52 +02:00
|
|
|
--sl-font-size-medium: 11px;
|
|
|
|
|
2022-05-12 23:22:49 +02:00
|
|
|
--sl-input-height-small: 18px;
|
|
|
|
--sl-input-height-medium: 24px;
|
|
|
|
|
|
|
|
--sl-spacing-small: 0.1rem;
|
|
|
|
--sl-spacing-medium: 0.5rem;
|
|
|
|
|
|
|
|
--sl-input-border-radius-small: 2px;
|
|
|
|
--sl-input-border-radius-medium: 3px;
|
2022-05-26 22:47:52 +02:00
|
|
|
--sl-input-border-color-focus: #E6E6E6;
|
2022-05-12 23:22:49 +02:00
|
|
|
}
|
2022-05-13 19:51:29 +02:00
|
|
|
|
2022-05-12 23:22:49 +02:00
|
|
|
`];
|