Defaul stylesheet print → new defaults.js (nique source of truth) + automatic generation of the default stylesheet for paged.js

This commit is contained in:
Julie Blanc 2026-03-08 09:24:53 +01:00
parent ccdd9bda05
commit 47bf70bb36
7 changed files with 115 additions and 49 deletions

View file

@ -197,6 +197,7 @@
<script setup>
import { ref, computed, watch, onMounted, inject, nextTick } from 'vue';
import bookIcon from '/assets/svg/book.svg?raw';
import { PAGE_DEFAULTS } from '../../utils/defaults';
import { useStylesheetStore } from '../../stores/stylesheet';
import { useDebounce } from '../../composables/useDebounce';
import { useCssSync } from '../../composables/useCssSync';
@ -212,25 +213,18 @@ const activeTab = inject('activeTab', ref('document'));
let isUpdatingFromStore = false;
const pageFormat = ref('A4');
const pageFormat = ref(PAGE_DEFAULTS.format);
const pageFormats = PAGE_DEFAULTS.formats;
const pageFormats = {
A4: { width: 210, height: 297 },
A5: { width: 148, height: 210 },
// A3: { width: 297, height: 420 },
// letter: { width: 216, height: 279 },
// legal: { width: 216, height: 356 },
};
const customWidth = ref(210);
const customHeight = ref(297);
const customWidth = ref(PAGE_DEFAULTS.formats[PAGE_DEFAULTS.format].width);
const customHeight = ref(PAGE_DEFAULTS.formats[PAGE_DEFAULTS.format].height);
const isCustomFormat = computed(() => pageFormat.value === 'custom');
const margins = ref({
top: { value: 20, unit: 'mm' },
bottom: { value: 20, unit: 'mm' },
left: { value: 20, unit: 'mm' },
right: { value: 20, unit: 'mm' },
top: { ...PAGE_DEFAULTS.margins.top },
bottom: { ...PAGE_DEFAULTS.margins.bottom },
left: { ...PAGE_DEFAULTS.margins.left },
right: { ...PAGE_DEFAULTS.margins.right },
});
const updateMarginUnit = (side, newUnit) => {