From 93df05c49fb1d95946f691a9182f6b7523a3e57f Mon Sep 17 00:00:00 2001 From: isUnknown Date: Fri, 9 Jan 2026 14:31:42 +0100 Subject: [PATCH] feat: implement inheritance lock/unlock with CSS commenting system MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add ability to lock/unlock inheritance for element styles while preserving custom values. Locked styles are commented in the CSS and restored when unlocked. New utilities: - Create css-comments.js with comment/uncomment functions - Add parseValueWithUnit to css-parsing.js for value parsing - Add getBlockState, commentCssBlock, uncommentCssBlock to stylesheet store ElementPopup improvements: - Detect inheritance state from CSS block state (active/commented/none) - Capture computed styles from iframe when unlocking with no custom CSS - Comment/uncomment CSS blocks instead of deleting them on lock toggle - Use nextTick to prevent race condition with watchers during popup init - Extract values from both active and commented CSS blocks Workflow: 1. First unlock: Capture computed styles → create CSS block 2. Lock: Comment the CSS block (styles preserved in comments) 3. Unlock again: Uncomment the block (styles restored) Fixes issue where CSS rules were created on popup open due to watcher race conditions during initialization. Co-Authored-By: Claude Sonnet 4.5 --- src/components/ElementPopup.vue | 104 ++++++++++++++++----- src/stores/stylesheet.js | 46 +++++++++- src/utils/css-comments.js | 155 ++++++++++++++++++++++++++++++++ src/utils/css-parsing.js | 20 ++++- 4 files changed, 300 insertions(+), 25 deletions(-) create mode 100644 src/utils/css-comments.js diff --git a/src/components/ElementPopup.vue b/src/components/ElementPopup.vue index ac34069..02e553d 100644 --- a/src/components/ElementPopup.vue +++ b/src/components/ElementPopup.vue @@ -258,7 +258,7 @@