import { h } from '@/h';
import '@build/tailwind/main.css';
// tab的app-routes模块
// import './tab';
import './app.ts';
import { start } from '@kevisual/tab-leader';
import './page/index.css';
import './main.css';

import { Page } from '@kevisual/store/page';
import { useContextKey } from '@kevisual/store/config';

const main = () => {
  start();
};
main();

const page = useContextKey('page', () => {
  return new Page({
    path: '',
    key: '',
    basename: '',
  });
});

page.addPage('/', 'home');
page.addPage('/ai', 'ai');
page.addPage('/list', 'list');

page.subscribe('home', async (page) => {
  const module = await import('./routes/home.ts');
  module?.route(page);
});

page.subscribe('ai', async (page) => {
  const module = await import('./routes/ai.ts');
  module?.route();
});

page.subscribe('list', async (page) => {
  const module = await import('./routes/list.ts');
  module?.route();
});
