enso/app/gui2/stories/histoire/utils.ts
somebody1234 f2651d58e4
[gui2] Component demos (#7945)
- Closes #7916

# Important Notes
None
2023-10-29 19:02:07 +00:00

23 lines
589 B
TypeScript

// @ts-nocheck
import { getCurrentInstance, ref, type App } from 'vue'
export const isDark = ref(false)
if (!window.__hst_controls_dark) {
// eslint-disable-next-line camelcase
window.__hst_controls_dark = []
}
// There could be multiple instances of the controls lib (in the controls book https://controls.histoire.dev)
window.__hst_controls_dark.push(isDark)
window.__hst_controls_dark_ready?.()
export function createSetupComponent(setup: (app: App) => void) {
return () => {
const app = getCurrentInstance()?.appContext.app
if (app) setup(app)
return null
}
}