Changes https://github.com/brave/leo/compare/075a3f9ed76e03bdc3f63d7dc4a7269e6dbdec29...e4af287f27ef5bb412a57a057d0edbbc81326168 - **BREAKING** [Icons]: Update icons from Figma ([#1378](https://github.com/brave/leo/pull/1378)) - [svelte5]: Use unmount not destroy ([#1399](https://github.com/brave/leo/pull/1399)) - [Svelte]: Minor bump ([#1398](https://github.com/brave/leo/pull/1398)) - **BREAKING** [Svelte]: Upgrade to Svelte 5 ([#1078](https://github.com/brave/leo/pull/1078)) - chore(deps): updates deps and adds .npmrc with min-release-age ([#1391](https://github.com/brave/leo/pull/1391)) - [Toggle]: Remove :hover effect on mobile ([#1390](https://github.com/brave/leo/pull/1390)) - [Radio]: Remove :hover effect on mobile ([#1389](https://github.com/brave/leo/pull/1389)) - [Checkbox]: Disable `:hover` effect on mobile ([#1388](https://github.com/brave/leo/pull/1388)) - [Button]: Disable :hover state on mobile ([#1387](https://github.com/brave/leo/pull/1387)) - Add transform transition and press scale to button ([#1385](https://github.com/brave/leo/pull/1385)) - Navigation style updates ([#1386](https://github.com/brave/leo/pull/1386)) - Bump postcss from 8.5.6 to 8.5.14 in /examples/example-ui-react ([#1383](https://github.com/brave/leo/pull/1383)) - Bump postcss from 8.5.6 to 8.5.14 ([#1384](https://github.com/brave/leo/pull/1384))
67 lines
2.7 KiB
TypeScript
67 lines
2.7 KiB
TypeScript
// Copyright (c) 2023 The Brave Authors. All rights reserved.
|
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
// Import web components here. They will be available on the page
|
|
// as <leo-{component}></leo-{component}>.
|
|
import '@brave/leo/web-components/alert'
|
|
import '@brave/leo/web-components/alertCenter'
|
|
import '@brave/leo/web-components/button'
|
|
import '@brave/leo/web-components/buttonMenu'
|
|
import '@brave/leo/web-components/checkbox'
|
|
import '@brave/leo/web-components/dialog'
|
|
import '@brave/leo/web-components/dropdown'
|
|
import '@brave/leo/web-components/icon'
|
|
import '@brave/leo/web-components/input'
|
|
import '@brave/leo/web-components/label'
|
|
import '@brave/leo/web-components/progressRing'
|
|
import '@brave/leo/web-components/textarea'
|
|
import '@brave/leo/web-components/toggle'
|
|
import '@brave/leo/web-components/tooltip'
|
|
import '@brave/leo/web-components/radioButton'
|
|
import { setIconBasePath } from '@brave/leo/web-components/icon'
|
|
import iconsMeta from '@brave/leo/icons/meta'
|
|
|
|
export {
|
|
showAlert as leoShowAlert
|
|
} from '@brave/leo/web-components/alertCenter'
|
|
|
|
// Note: This file is loaded for some extensions, and on those pages we fall back
|
|
// to loading icons from the `chrome://` scheme.
|
|
const chromeSchemes = ['chrome:', 'chrome-untrusted:']
|
|
const scheme = chromeSchemes.includes(window.location.protocol)
|
|
? `${window.location.protocol}//`
|
|
: 'chrome://'
|
|
|
|
setIconBasePath(`${scheme}resources/brave-icons`)
|
|
|
|
// In Chromium UI Nala variables haven't necessarily been included. We
|
|
// make sure the variables are imported so the controls look correct.
|
|
const variablesUrl = `resources/brave/css/nala.css`
|
|
const variablesLink = document.querySelector(`link[rel=stylesheet][href$="//${variablesUrl}"]`)
|
|
if (!variablesLink) {
|
|
const link = document.createElement('link')
|
|
link.setAttribute('rel', 'stylesheet')
|
|
// When we create a link to the variables file, use `scheme` rather than a
|
|
// scheme relative url, to ensure the link loads correctly for extensions.
|
|
link.setAttribute('href', `${scheme}${variablesUrl}`)
|
|
document.head.appendChild(link)
|
|
}
|
|
|
|
declare global {
|
|
interface Window {
|
|
leoIcons: Set<string>
|
|
}
|
|
}
|
|
|
|
window.leoIcons = new Set(Object.keys(iconsMeta.icons))
|
|
|
|
// Note: We can't use the `if expr` here because this isn't run through the preprocessor.
|
|
if (!/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
|
|
import(/* webpackIgnore: true */`${scheme}resources/cr_components/color_change_listener/colors_css_updater.js`)
|
|
.then(({ ColorChangeUpdater }) => {
|
|
ColorChangeUpdater.forDocument().start();
|
|
});
|
|
}
|