mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 17:43:35 -06:00
* moved themecontext to data * chore(grafana-ui): re-export ThemeContext from grafana/data for backwards compatibility * Moved icon bundling to core. * feat(plugins): share react-inlinesvg with plugins for grafana/ui bundling * chore(codeowners): add generate-icon-bundle.js to file * chore(storybook): update path to iconBundle file for theme * feat(plugins): share i18n dependency via systemjs * Make sure that icon bundle is initialized for tests. * Removed comment. * added tests for icon root. * Removing the need of having an init variable. * feat(grafana-ui): add icon svgs to bundle for projects that don't rely on grafana --------- Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
49 lines
1.4 KiB
Plaintext
49 lines
1.4 KiB
Plaintext
/* eslint-disable import/order */
|
|
// DO NOT EDIT THIS FILE
|
|
// This file is automatically generated (do not edit it here)
|
|
// see @grafana/ui/scripts/generate-icon-bundle.js
|
|
|
|
|
|
import { cacheStore } from 'react-inlinesvg';
|
|
|
|
// do not edit this list directly
|
|
// the list of icons live here: @grafana/ui/components/Icon/cached.json
|
|
//{{imports}}
|
|
// do not edit this list directly
|
|
// the list of icons live here: @grafana/ui/components/Icon/cached.json
|
|
|
|
let cacheInitialized = false;
|
|
|
|
function cacheItem(content: string, path: string) {
|
|
cacheStore[path] = { content, status: 'loaded' };
|
|
}
|
|
|
|
function createPathResolver() {
|
|
let root = 'public/img/icons/';
|
|
|
|
// This function needs to be called after index.js loads to give the
|
|
// application time to modify __webpack_public_path__ with a CDN path
|
|
const grafanaPublicPath = typeof window !== 'undefined' && window.__grafana_public_path__;
|
|
if (grafanaPublicPath) {
|
|
root = grafanaPublicPath + 'img/icons/';
|
|
}
|
|
|
|
return (path: string) => {
|
|
return root + path;
|
|
};
|
|
}
|
|
|
|
export function initIconCache() {
|
|
if (cacheInitialized) {
|
|
return;
|
|
}
|
|
cacheInitialized = true;
|
|
const resolvePath = createPathResolver();
|
|
|
|
// do not edit this list directly
|
|
// the list of icons live here: @grafana/ui/components/Icon/cached.json
|
|
//{{cacheItems}}
|
|
// do not edit this list directly
|
|
// the list of icons live here: @grafana/ui/components/Icon/cached.json
|
|
}
|