import { defineStore } from 'pinia' import { ref, computed } from 'vue' import type { Template, TemplateElement, ContainerElement, SizeConstraint, PositionMode } from '../core/types' import { findElementById, findParent, isContainer, sz } from '../core/types' import { generateMockData } from '../core/mock-data-generator' import { useUndoRedo } from '../composables/useUndoRedo' function createDefaultTemplate(): Template { return { id: 'tpl_default', name: 'Yeni Şablon', page: { width: 210, height: 297 }, fonts: ['Noto Sans'], root: { id: 'root', type: 'container', position: { type: 'flow' }, size: { width: sz.auto(), height: sz.auto() }, direction: 'column', gap: 5, padding: { top: 15, right: 15, bottom: 15, left: 15 }, align: 'stretch', justify: 'start', style: {}, children: [ { id: 'el_001', type: 'static_text', position: { type: 'flow' }, size: { width: sz.auto(), height: sz.auto() }, style: { fontSize: 18, fontWeight: 'bold', color: '#1a1a1a' }, content: 'dreport', }, { id: 'el_002', type: 'static_text', position: { type: 'flow' }, size: { width: sz.auto(), height: sz.auto() }, style: { fontSize: 11, color: '#666666' }, content: 'Belge tasarım aracı — sürükle ve bırak', }, ], }, } } export const useTemplateStore = defineStore('template', () => { const template = ref