50 lines
1.3 KiB
JavaScript
50 lines
1.3 KiB
JavaScript
import { NewState, State } from '@apigo.cc/state'
|
|
import '@apigo.cc/bootstrap'
|
|
|
|
// Re-exports
|
|
export * from './http.js'
|
|
export * from './ui.js'
|
|
export * from './form.js'
|
|
export * from './controls.js'
|
|
export * from './list.js'
|
|
export * from './nav.js'
|
|
export * from './interaction.js'
|
|
|
|
export { State }
|
|
|
|
if (typeof window !== 'undefined') {
|
|
window.addEventListener('beforeunload', (event) => {
|
|
if (State.exitBlocks > 0) event.preventDefault()
|
|
})
|
|
}
|
|
|
|
const htmlNode = document.documentElement;
|
|
if (!htmlNode.hasAttribute('$data-bs-theme') && !htmlNode.hasAttribute('data-bs-theme')) {
|
|
htmlNode.setAttribute('$data-bs-theme', "LocalStorage.darkMode?'dark':'light'");
|
|
}
|
|
|
|
// Side effects: ensure global namespaces are populated
|
|
import { HTTP } from './http.js'
|
|
import { UI } from './ui.js'
|
|
import { AutoForm } from './form.js'
|
|
import { MouseMover } from './interaction.js'
|
|
import { VirtualScroll } from './list.js'
|
|
import './nav.js'
|
|
import './controls.js'
|
|
|
|
globalThis.HTTP = HTTP
|
|
globalThis.UI = UI
|
|
globalThis.AutoForm = AutoForm
|
|
globalThis.MouseMover = MouseMover
|
|
globalThis.VirtualScroll = VirtualScroll
|
|
|
|
const ApigoBase = {
|
|
HTTP, UI, AutoForm, MouseMover, VirtualScroll, State,
|
|
List: VirtualScroll
|
|
};
|
|
|
|
if (typeof document !== 'undefined') {
|
|
globalThis.ApigoBase = ApigoBase;
|
|
}
|
|
|