tmp_c3.py 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. """C-3 transition:all 治理 22 文件 35 处
  4. 策略:保留各站点原有时长/缓动,仅把 `all` 替换为「该选择器状态规则实际变更的属性」显式清单。
  5. 依据:逐站点读取 base 规则 + 状态规则(.active/--active/:active/动态类/内联 :style)后定性;
  6. 无状态变化的死过渡不存在(risk-card 的 risk-level-* 改 border-left-color,已显式化)。
  7. 属性清单速查:
  8. dot .active{width,border-radius,background}
  9. toggle-item --active{color,background(grad),border-color}
  10. ac-tab .active{font-weight}
  11. qd-option .selected{border-color,background}
  12. tab-item(tasks) --hover{background} --active{background(grad),box-shadow}
  13. q-option/logic :active{transform}
  14. tab-item(meal) .tab-active{background(grad),color,font-weight}
  15. member-item .member-selected{border-color,background}
  16. add-member-entry :active{background-color}
  17. save-btn :active{opacity,transform}
  18. sc-opt(ai) :active{background}
  19. sc-opt(family) .sc-opt-sel{border-color,background}
  20. tag-btn .tag-active{border-color,background,box-shadow}
  21. submit-btn :active{transform}
  22. sync-btn .syncing{opacity}
  23. risk-card .risk-level-*{border-left-color} + .important-card.risk-level-*{background(grad)}
  24. step-num .step.active/.done .step-num{background,color}
  25. member-tab .active{background,border-color,color}
  26. ts-card .active{border-color,background}
  27. ad-banner-dot .active{width,background}
  28. funnel-step 模板 :style width 内联变更
  29. option/quiz :active{transform}
  30. tab-bar__item :active{transform}
  31. role-card/.mascot-card .active{border-color,background}
  32. step-dot --active/--done/--pending{background,border-color}
  33. goal-card/type-card/q-option --selected{border-color,background}
  34. btn --primary:active{opacity,transform} --outline:active{background}
  35. filter-tab --active{background,border-color,color,box-shadow} :active{transform}
  36. emoji-item --active{background(grad),border-color,box-shadow} :active{transform}
  37. """
  38. import io
  39. import re
  40. import sys
  41. # (file, lineno, old, new)
  42. JOBS = [
  43. ('components/DimensionActivities.vue', 323,
  44. 'transition: all 0.3s ease;',
  45. 'transition: width 0.3s ease, border-radius 0.3s ease, background-color 0.3s ease;'),
  46. ('components/wuxing-sandbox.vue', 799,
  47. 'transition: all 0.2s;',
  48. 'transition: color 0.2s, background-color 0.2s, border-color 0.2s;'),
  49. ('pages/article-center/index.vue', 441,
  50. 'transition: all 0.2s;',
  51. 'transition: font-weight 0.2s;'),
  52. ('pages/body-detail/dimension-questionnaire.vue', 565,
  53. 'transition: all 0.2s;',
  54. 'transition: border-color 0.2s, background-color 0.2s;'),
  55. ('pages/child/tasks.vue', 442,
  56. 'transition: all var(--transition-base, 0.25s ease);',
  57. 'transition: background-color var(--transition-base, 0.25s ease), box-shadow var(--transition-base, 0.25s ease);'),
  58. ('pages/cognitive-test/logic-test.vue', 395,
  59. 'transition: all 0.2s;',
  60. 'transition: transform 0.2s;'),
  61. ('pages/diet/meal-config.vue', 229,
  62. 'transition: all 0.2s ease;',
  63. 'transition: color 0.2s ease, background-color 0.2s ease, font-weight 0.2s ease;'),
  64. ('pages/diet/meal-config.vue', 270,
  65. 'transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);',
  66. '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);'),
  67. ('pages/diet/meal-config.vue', 340,
  68. 'transition: all 0.2s ease;',
  69. 'transition: background-color 0.2s ease;'),
  70. ('pages/diet/meal-config.vue', 379,
  71. 'transition: all 0.2s ease;',
  72. 'transition: opacity 0.2s ease, transform 0.2s ease;'),
  73. ('pages/family/self-check-ai.vue', 468,
  74. 'transition: all 0.2s;',
  75. 'transition: background-color 0.2s;'),
  76. ('pages/family/self-check.vue', 374,
  77. 'transition: all 0.2s;',
  78. 'transition: border-color 0.2s, background-color 0.2s;'),
  79. ('pages/growth/diet-checkin.vue', 510,
  80. 'transition: all 0.2s ease;',
  81. 'transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;'),
  82. ('pages/growth/diet-checkin.vue', 549,
  83. 'transition: all 0.2s ease;',
  84. 'transition: transform 0.2s ease;'),
  85. ('pages/growth/exercise-checkin.vue', 507,
  86. 'transition: all 0.2s ease;',
  87. 'transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;'),
  88. ('pages/growth/exercise-checkin.vue', 514,
  89. 'transition: all 0.2s ease;',
  90. 'transition: opacity 0.2s ease;'),
  91. ('pages/growth/exercise-checkin.vue', 551,
  92. 'transition: all 0.2s ease;',
  93. 'transition: transform 0.2s ease;'),
  94. ('pages/growth/sleep-checkin.vue', 231,
  95. 'transition: all 0.2s ease;',
  96. 'transition: transform 0.2s ease;'),
  97. ('pages/health/gut-flora-risks-detail.vue', 396,
  98. 'transition: all 0.2s;',
  99. 'transition: border-left-color 0.2s, background-color 0.2s;'),
  100. ('pages/health/health-plan-summary.vue', 1239,
  101. 'transition: all 0.3s;',
  102. 'transition: background-color 0.3s, color 0.3s;'),
  103. ('pages/health/health-plan-summary.vue', 1590,
  104. 'transition: all 0.2s;',
  105. 'transition: background-color 0.2s, border-color 0.2s, color 0.2s;'),
  106. ('pages/health/teacher-service.vue', 243,
  107. 'transition: all 0.2s;',
  108. 'transition: border-color 0.2s, background-color 0.2s;'),
  109. ('pages/home-pages/components/AdBanner.vue', 372,
  110. 'transition: all 0.3s ease;',
  111. 'transition: width 0.3s ease, background-color 0.3s ease;'),
  112. ('pages/promotion/index.vue', 889,
  113. 'transition: all 0.3s ease;',
  114. 'transition: width 0.3s ease;'),
  115. ('pages/psych-assessment/quiz.vue', 373,
  116. 'transition: all 0.2s;',
  117. 'transition: transform 0.2s;'),
  118. ('pages/tasks/review.vue', 179,
  119. 'transition: all var(--transition-base, 0.25s ease);',
  120. 'transition: transform var(--transition-base, 0.25s ease);'),
  121. ('pages/user-edit/user-edit.vue', 937,
  122. 'transition: all 0.3s;',
  123. 'transition: border-color 0.3s, background-color 0.3s;'),
  124. ('pages/user-edit/user-edit.vue', 1092,
  125. 'transition: all 0.3s;',
  126. 'transition: border-color 0.3s, background-color 0.3s;'),
  127. ('pages/wisdom-detail/self-quiz.vue', 519,
  128. 'transition: all 0.3s;',
  129. 'transition: background-color 0.3s, border-color 0.3s;'),
  130. ('pages/wisdom-detail/self-quiz.vue', 604,
  131. 'transition: all 0.3s;',
  132. 'transition: background-color 0.3s, border-color 0.3s;'),
  133. ('pages/wisdom-detail/self-quiz.vue', 651,
  134. 'transition: all 0.3s;',
  135. 'transition: background-color 0.3s, border-color 0.3s;'),
  136. ('pages/wisdom-detail/self-quiz.vue', 765,
  137. 'transition: all 0.3s;',
  138. 'transition: background-color 0.3s, border-color 0.3s;'),
  139. ('pages/wisdom-detail/self-quiz.vue', 829,
  140. 'transition: all 0.3s;',
  141. 'transition: opacity 0.3s, transform 0.3s, background-color 0.3s;'),
  142. ('pages/wishes/index.vue', 707,
  143. 'transition: all 0.25s ease;',
  144. 'transition: color 0.25s ease, background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;'),
  145. ('pages/wishes/index.vue', 1018,
  146. 'transition: all 0.2s ease;',
  147. 'transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;'),
  148. ]
  149. RESIDUAL_RE = re.compile(r'transition:\s*all\b')
  150. def main():
  151. files = {}
  152. for page, ln, old, new in JOBS:
  153. if page not in files:
  154. files[page] = io.open(page, encoding='utf-8').read().split('\n')
  155. lines = files[page]
  156. line = lines[ln - 1]
  157. if old not in line:
  158. raise RuntimeError('%s:%d 未找到 %r(实际: %r)' % (page, ln, old, line.strip()[:80]))
  159. lines[ln - 1] = line.replace(old, new, 1)
  160. print('%s:%d %s -> %s' % (page, ln, old[:46], new[:60]))
  161. for page, lines in files.items():
  162. io.open(page, 'w', encoding='utf-8', newline='').write('\n'.join(lines))
  163. residual = RESIDUAL_RE.findall('\n'.join(lines))
  164. if residual:
  165. raise RuntimeError('%s: 终检残留 transition:all x%d' % (page, len(residual)))
  166. print('C-3 执行完毕:%d 处' % len(JOBS))
  167. if __name__ == '__main__':
  168. sys.exit(main())