2026-06-05 20:05:26 +08:00
|
|
|
import { NewState, State } from '@apigo.cc/state'
|
|
|
|
|
import '@apigo.cc/bootstrap'
|
2026-05-14 20:04:31 +08:00
|
|
|
|
|
|
|
|
// Re-exports
|
|
|
|
|
export * from './http.js'
|
|
|
|
|
export * from './ui.js'
|
|
|
|
|
export * from './form.js'
|
2026-05-29 22:45:56 +08:00
|
|
|
export * from './controls.js'
|
2026-05-14 20:04:31 +08:00
|
|
|
export * from './list.js'
|
|
|
|
|
export * from './nav.js'
|
|
|
|
|
export * from './interaction.js'
|
|
|
|
|
|
2026-06-05 20:05:26 +08:00
|
|
|
export { State }
|
2026-05-14 20:04:31 +08:00
|
|
|
|
|
|
|
|
if (typeof window !== 'undefined') {
|
|
|
|
|
window.addEventListener('beforeunload', (event) => {
|
|
|
|
|
if (State.exitBlocks > 0) event.preventDefault()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-18 20:23:05 +08:00
|
|
|
const htmlNode = document.documentElement;
|
|
|
|
|
if (!htmlNode.hasAttribute('$data-bs-theme') && !htmlNode.hasAttribute('data-bs-theme')) {
|
|
|
|
|
htmlNode.setAttribute('$data-bs-theme', "LocalStorage.darkMode?'dark':'light'");
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-14 20:04:31 +08:00
|
|
|
// 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'
|
2026-06-05 20:05:26 +08:00
|
|
|
import { VirtualScroll } from './list.js'
|
2026-05-14 20:04:31 +08:00
|
|
|
|
|
|
|
|
globalThis.HTTP = HTTP
|
|
|
|
|
globalThis.UI = UI
|
|
|
|
|
globalThis.AutoForm = AutoForm
|
|
|
|
|
globalThis.MouseMover = MouseMover
|
2026-06-05 20:05:26 +08:00
|
|
|
globalThis.VirtualScroll = VirtualScroll
|
|
|
|
|
|
|
|
|
|
const ApigoBase = {
|
|
|
|
|
HTTP, UI, AutoForm, MouseMover, VirtualScroll, State
|
|
|
|
|
};
|
2026-05-14 20:04:31 +08:00
|
|
|
|
2026-06-04 18:52:30 +08:00
|
|
|
import { RefreshState } from '@apigo.cc/state'
|
2026-05-14 20:04:31 +08:00
|
|
|
if (typeof document !== 'undefined') {
|
2026-06-05 20:05:26 +08:00
|
|
|
globalThis.ApigoBase = ApigoBase;
|
|
|
|
|
|
2026-05-18 20:23:05 +08:00
|
|
|
const doRefresh = () => RefreshState(document.documentElement)
|
2026-06-04 18:52:30 +08:00
|
|
|
if (document.readyState !== 'loading') setTimeout(doRefresh, 1)
|
|
|
|
|
else document.addEventListener('DOMContentLoaded', () => setTimeout(doRefresh, 1), true)
|
2026-05-14 20:04:31 +08:00
|
|
|
}
|
2026-05-18 20:23:05 +08:00
|
|
|
|