<template>
    <!-- 渲染区域 -->
    <Render></Render>
    <!-- 右侧工具合集 -->
    <RightNav></RightNav>
</template>

<script setup>
import { useI18n } from 'vue-i18n';
import Render from '@/components/render';
import RightNav from '@/components/right-nav.vue';
import { onMounted } from 'vue';
import { setDefaultCss } from './hook/css';
import { NetlistRender } from './hook/render';

import * as d3 from 'd3';
import { globalLookup } from './hook/global';

const { t } = useI18n();

onMounted(async () => {
    // 设置 css 宏，纠正样式
    setDefaultCss();

    // 初始化载入 netlist 的 json 文件
    const [ netJson, skinBinary ] = await window.readNetFile();

    const render = globalLookup.netlistRender;
    const skinManager = globalLookup.skinManager;

    skinManager.load(skinBinary);

    render.load(netJson);
    const layout = await render.createLayout();
    const svg = await render.render(layout, '#netlist');

    console.log(svg);
});

</script>

<style>
#app {
    font-family: Avenir, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
</style>
