Versie 0.2.0
This commit is contained in:
commit
e77d8fd373
495 files changed
+81026
No files matched your search
@@ -0,0 +1,21 @@
|
||||
// Generated, do not edit. sha256:fbeb70898a324872c8f2444d8e03beae326a416826348a59cda101932ba82f5c
|
||||
import { SYSTEM_PAGE } from '../../shared/config.js';
|
||||
import { createRegistry } from '../../shared/registry.js';
|
||||
import { locked } from '../license.js';
|
||||
|
||||
const tabs = createRegistry('system tab', {
|
||||
validate: (e) => { if (!Object.values(SYSTEM_PAGE.TABS).includes(e.tab)) throw new Error(`Unknown system tab '${e.tab}'.`); },
|
||||
});
|
||||
|
||||
export function registerSystemTab(tab) {
|
||||
const feature = tab.feature ?? null;
|
||||
tabs.register({ ...tab, id: `${tab.id}:${feature ?? ''}`, tab: tab.id, feature, label: tab.label ?? `nav.${tab.id}` });
|
||||
}
|
||||
|
||||
export function systemTabs() {
|
||||
return Object.values(SYSTEM_PAGE.TABS).flatMap(id => {
|
||||
const own = tabs.list().filter(r => r.tab === id).map(r => ({ ...r, id }));
|
||||
const pick = own.find(r => r.feature && !locked(r.feature)) || own.find(r => !r.feature);
|
||||
return pick ? [pick] : [];
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user