#!/usr/bin/env python # -*- coding: utf-8 -*- """C-3 transition:all 治理 22 文件 35 处 策略:保留各站点原有时长/缓动,仅把 `all` 替换为「该选择器状态规则实际变更的属性」显式清单。 依据:逐站点读取 base 规则 + 状态规则(.active/--active/:active/动态类/内联 :style)后定性; 无状态变化的死过渡不存在(risk-card 的 risk-level-* 改 border-left-color,已显式化)。 属性清单速查: dot .active{width,border-radius,background} toggle-item --active{color,background(grad),border-color} ac-tab .active{font-weight} qd-option .selected{border-color,background} tab-item(tasks) --hover{background} --active{background(grad),box-shadow} q-option/logic :active{transform} tab-item(meal) .tab-active{background(grad),color,font-weight} member-item .member-selected{border-color,background} add-member-entry :active{background-color} save-btn :active{opacity,transform} sc-opt(ai) :active{background} sc-opt(family) .sc-opt-sel{border-color,background} tag-btn .tag-active{border-color,background,box-shadow} submit-btn :active{transform} sync-btn .syncing{opacity} risk-card .risk-level-*{border-left-color} + .important-card.risk-level-*{background(grad)} step-num .step.active/.done .step-num{background,color} member-tab .active{background,border-color,color} ts-card .active{border-color,background} ad-banner-dot .active{width,background} funnel-step 模板 :style width 内联变更 option/quiz :active{transform} tab-bar__item :active{transform} role-card/.mascot-card .active{border-color,background} step-dot --active/--done/--pending{background,border-color} goal-card/type-card/q-option --selected{border-color,background} btn --primary:active{opacity,transform} --outline:active{background} filter-tab --active{background,border-color,color,box-shadow} :active{transform} emoji-item --active{background(grad),border-color,box-shadow} :active{transform} """ import io import re import sys # (file, lineno, old, new) JOBS = [ ('components/DimensionActivities.vue', 323, 'transition: all 0.3s ease;', 'transition: width 0.3s ease, border-radius 0.3s ease, background-color 0.3s ease;'), ('components/wuxing-sandbox.vue', 799, 'transition: all 0.2s;', 'transition: color 0.2s, background-color 0.2s, border-color 0.2s;'), ('pages/article-center/index.vue', 441, 'transition: all 0.2s;', 'transition: font-weight 0.2s;'), ('pages/body-detail/dimension-questionnaire.vue', 565, 'transition: all 0.2s;', 'transition: border-color 0.2s, background-color 0.2s;'), ('pages/child/tasks.vue', 442, 'transition: all var(--transition-base, 0.25s ease);', 'transition: background-color var(--transition-base, 0.25s ease), box-shadow var(--transition-base, 0.25s ease);'), ('pages/cognitive-test/logic-test.vue', 395, 'transition: all 0.2s;', 'transition: transform 0.2s;'), ('pages/diet/meal-config.vue', 229, 'transition: all 0.2s ease;', 'transition: color 0.2s ease, background-color 0.2s ease, font-weight 0.2s ease;'), ('pages/diet/meal-config.vue', 270, 'transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);', 'transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);'), ('pages/diet/meal-config.vue', 340, 'transition: all 0.2s ease;', 'transition: background-color 0.2s ease;'), ('pages/diet/meal-config.vue', 379, 'transition: all 0.2s ease;', 'transition: opacity 0.2s ease, transform 0.2s ease;'), ('pages/family/self-check-ai.vue', 468, 'transition: all 0.2s;', 'transition: background-color 0.2s;'), ('pages/family/self-check.vue', 374, 'transition: all 0.2s;', 'transition: border-color 0.2s, background-color 0.2s;'), ('pages/growth/diet-checkin.vue', 510, 'transition: all 0.2s ease;', 'transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;'), ('pages/growth/diet-checkin.vue', 549, 'transition: all 0.2s ease;', 'transition: transform 0.2s ease;'), ('pages/growth/exercise-checkin.vue', 507, 'transition: all 0.2s ease;', 'transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;'), ('pages/growth/exercise-checkin.vue', 514, 'transition: all 0.2s ease;', 'transition: opacity 0.2s ease;'), ('pages/growth/exercise-checkin.vue', 551, 'transition: all 0.2s ease;', 'transition: transform 0.2s ease;'), ('pages/growth/sleep-checkin.vue', 231, 'transition: all 0.2s ease;', 'transition: transform 0.2s ease;'), ('pages/health/gut-flora-risks-detail.vue', 396, 'transition: all 0.2s;', 'transition: border-left-color 0.2s, background-color 0.2s;'), ('pages/health/health-plan-summary.vue', 1239, 'transition: all 0.3s;', 'transition: background-color 0.3s, color 0.3s;'), ('pages/health/health-plan-summary.vue', 1590, 'transition: all 0.2s;', 'transition: background-color 0.2s, border-color 0.2s, color 0.2s;'), ('pages/health/teacher-service.vue', 243, 'transition: all 0.2s;', 'transition: border-color 0.2s, background-color 0.2s;'), ('pages/home-pages/components/AdBanner.vue', 372, 'transition: all 0.3s ease;', 'transition: width 0.3s ease, background-color 0.3s ease;'), ('pages/promotion/index.vue', 889, 'transition: all 0.3s ease;', 'transition: width 0.3s ease;'), ('pages/psych-assessment/quiz.vue', 373, 'transition: all 0.2s;', 'transition: transform 0.2s;'), ('pages/tasks/review.vue', 179, 'transition: all var(--transition-base, 0.25s ease);', 'transition: transform var(--transition-base, 0.25s ease);'), ('pages/user-edit/user-edit.vue', 937, 'transition: all 0.3s;', 'transition: border-color 0.3s, background-color 0.3s;'), ('pages/user-edit/user-edit.vue', 1092, 'transition: all 0.3s;', 'transition: border-color 0.3s, background-color 0.3s;'), ('pages/wisdom-detail/self-quiz.vue', 519, 'transition: all 0.3s;', 'transition: background-color 0.3s, border-color 0.3s;'), ('pages/wisdom-detail/self-quiz.vue', 604, 'transition: all 0.3s;', 'transition: background-color 0.3s, border-color 0.3s;'), ('pages/wisdom-detail/self-quiz.vue', 651, 'transition: all 0.3s;', 'transition: background-color 0.3s, border-color 0.3s;'), ('pages/wisdom-detail/self-quiz.vue', 765, 'transition: all 0.3s;', 'transition: background-color 0.3s, border-color 0.3s;'), ('pages/wisdom-detail/self-quiz.vue', 829, 'transition: all 0.3s;', 'transition: opacity 0.3s, transform 0.3s, background-color 0.3s;'), ('pages/wishes/index.vue', 707, 'transition: all 0.25s ease;', 'transition: color 0.25s ease, background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;'), ('pages/wishes/index.vue', 1018, 'transition: all 0.2s ease;', 'transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;'), ] RESIDUAL_RE = re.compile(r'transition:\s*all\b') def main(): files = {} for page, ln, old, new in JOBS: if page not in files: files[page] = io.open(page, encoding='utf-8').read().split('\n') lines = files[page] line = lines[ln - 1] if old not in line: raise RuntimeError('%s:%d 未找到 %r(实际: %r)' % (page, ln, old, line.strip()[:80])) lines[ln - 1] = line.replace(old, new, 1) print('%s:%d %s -> %s' % (page, ln, old[:46], new[:60])) for page, lines in files.items(): io.open(page, 'w', encoding='utf-8', newline='').write('\n'.join(lines)) residual = RESIDUAL_RE.findall('\n'.join(lines)) if residual: raise RuntimeError('%s: 终检残留 transition:all x%d' % (page, len(residual))) print('C-3 执行完毕:%d 处' % len(JOBS)) if __name__ == '__main__': sys.exit(main())