refactor: extract reusable UI components and composables from TextSettings
Major refactoring to improve code quality and reduce duplication: TextSettings.vue: 1127 → 269 lines (-76%) New composables: - useCssUpdater.js: generic CSS update/remove functions - useCssSync.js: CSS parsing to form fields New UI components: - UnitToggle.vue: reusable unit selector buttons - InputWithUnit.vue: number input with unit toggle - MarginEditor.vue: simple/detailed margin editor with sync Benefits: - Reusable components for other settings panels - Centralized CSS manipulation logic - Better separation of concerns - Easier to test and maintain 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
94112ab1a8
commit
c4d2015a69
6 changed files with 647 additions and 1006 deletions
28
src/components/ui/UnitToggle.vue
Normal file
28
src/components/ui/UnitToggle.vue
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<template>
|
||||
<div class="unit-toggle">
|
||||
<button
|
||||
v-for="unit in units"
|
||||
:key="unit"
|
||||
type="button"
|
||||
:class="{ active: modelValue === unit }"
|
||||
@click="$emit('update:modelValue', unit)"
|
||||
>
|
||||
{{ unit }}
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
defineProps({
|
||||
modelValue: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
units: {
|
||||
type: Array,
|
||||
default: () => ['mm', 'px']
|
||||
}
|
||||
});
|
||||
|
||||
defineEmits(['update:modelValue']);
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue