claude-dev-env 1.82.0 → 1.84.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/CLAUDE.md +16 -13
  2. package/_shared/pr-loop/audit-contract.md +24 -12
  3. package/_shared/pr-loop/scripts/CLAUDE.md +1 -0
  4. package/_shared/pr-loop/scripts/README.md +1 -0
  5. package/_shared/pr-loop/scripts/_claude_permissions_common.py +16 -5
  6. package/_shared/pr-loop/scripts/code_rules_gate.py +2 -3
  7. package/_shared/pr-loop/scripts/pr_loop_shared_constants/CLAUDE.md +1 -0
  8. package/_shared/pr-loop/scripts/pr_loop_shared_constants/reviewer_availability_constants.py +12 -0
  9. package/_shared/pr-loop/scripts/pr_loop_shared_constants/terminology_sweep_constants.py +0 -2
  10. package/_shared/pr-loop/scripts/reviewer_availability.py +182 -0
  11. package/_shared/pr-loop/scripts/reviews_disabled.py +2 -0
  12. package/_shared/pr-loop/scripts/terminology_sweep.py +9 -33
  13. package/_shared/pr-loop/scripts/tests/CLAUDE.md +2 -0
  14. package/_shared/pr-loop/scripts/tests/test__claude_permissions_common.py +212 -0
  15. package/_shared/pr-loop/scripts/tests/test_agent_config_carveout.py +18 -0
  16. package/_shared/pr-loop/scripts/tests/test_claude_permissions_common.py +18 -0
  17. package/_shared/pr-loop/scripts/tests/test_code_rules_gate.py +37 -0
  18. package/_shared/pr-loop/scripts/tests/test_reviewer_availability.py +159 -0
  19. package/_shared/pr-loop/scripts/tests/test_reviewer_availability_constants.py +36 -0
  20. package/_shared/pr-loop/scripts/tests/test_reviews_disabled.py +14 -0
  21. package/_shared/pr-loop/scripts/tests/test_terminology_sweep.py +14 -4
  22. package/agents/clean-coder.md +3 -0
  23. package/audit-rubrics/category_rubrics/category-o-docstring-vs-impl-drift.md +1 -1
  24. package/bin/install.mjs +16 -8
  25. package/bin/install.test.mjs +17 -6
  26. package/commands/CLAUDE.md +0 -1
  27. package/docs/CODE_RULES.md +1 -1
  28. package/hooks/blocking/CLAUDE.md +2 -4
  29. package/hooks/blocking/code_rules_constants_config.py +164 -1
  30. package/hooks/blocking/code_rules_docstrings.py +428 -15
  31. package/hooks/blocking/code_rules_enforcer.py +33 -0
  32. package/hooks/blocking/code_rules_imports_logging.py +867 -1
  33. package/hooks/blocking/code_rules_magic_values.py +5 -0
  34. package/hooks/blocking/code_rules_naming_collection.py +152 -6
  35. package/hooks/blocking/code_rules_shared.py +34 -0
  36. package/hooks/blocking/code_rules_string_magic.py +68 -0
  37. package/hooks/blocking/duplicate_rmtree_helper_blocker.py +4 -4
  38. package/hooks/blocking/pre_tool_use_dispatcher.py +3 -3
  39. package/hooks/blocking/reviewer_spawn_gate.py +182 -0
  40. package/hooks/blocking/stale_comment_reference_blocker.py +267 -0
  41. package/hooks/blocking/state_description_blocker.py +96 -5
  42. package/hooks/blocking/test_code_rules_config_duplicate_path_anchor.py +132 -0
  43. package/hooks/blocking/test_code_rules_enforcer_cap_meta.py +2 -0
  44. package/hooks/blocking/test_code_rules_enforcer_docstring_delegation_summary.py +385 -0
  45. package/hooks/blocking/test_code_rules_enforcer_docstring_prose_wall_illustration.py +197 -0
  46. package/hooks/blocking/test_code_rules_enforcer_docstring_runon_sentence.py +27 -0
  47. package/hooks/blocking/test_code_rules_enforcer_join_separator_magic.py +67 -0
  48. package/hooks/blocking/test_code_rules_enforcer_module_docstring_roster.py +40 -0
  49. package/hooks/blocking/test_code_rules_enforcer_naive_datetime.py +213 -0
  50. package/hooks/blocking/test_code_rules_enforcer_referenced_underscore_loop.py +169 -0
  51. package/hooks/blocking/test_code_rules_enforcer_split_constants_config.py +33 -0
  52. package/hooks/blocking/test_code_rules_enforcer_split_shared.py +23 -0
  53. package/hooks/blocking/test_code_rules_js_bare_flag_return_directive.py +266 -0
  54. package/hooks/blocking/test_code_rules_js_sibling_return_object_key_drift.py +490 -0
  55. package/hooks/blocking/test_code_rules_logging_adjacent_literals.py +171 -0
  56. package/hooks/blocking/test_code_rules_magic_values.py +54 -0
  57. package/hooks/blocking/test_duplicate_rmtree_helper_blocker.py +0 -6
  58. package/hooks/blocking/test_pr_converge_bugteam_enforcer_state_tolerance.py +184 -0
  59. package/hooks/blocking/test_pre_tool_use_dispatcher.py +9 -3
  60. package/hooks/blocking/test_reviewer_spawn_gate.py +230 -0
  61. package/hooks/blocking/test_shared_stdin_adoption.py +5 -30
  62. package/hooks/blocking/test_stale_comment_reference_blocker.py +236 -0
  63. package/hooks/blocking/test_state_description_blocker.py +135 -0
  64. package/hooks/hooks.json +5 -0
  65. package/hooks/hooks_constants/CLAUDE.md +3 -4
  66. package/hooks/hooks_constants/blocking_check_limits.py +46 -0
  67. package/hooks/hooks_constants/code_rules_enforcer_constants.py +41 -0
  68. package/hooks/hooks_constants/code_rules_path_utils_constants.py +1 -1
  69. package/hooks/hooks_constants/duplicate_rmtree_helper_blocker_constants.py +0 -1
  70. package/hooks/hooks_constants/post_tool_use_dispatcher_constants.py +0 -5
  71. package/hooks/hooks_constants/pre_tool_use_dispatcher_constants.py +4 -0
  72. package/hooks/hooks_constants/reviewer_spawn_gate_constants.py +41 -0
  73. package/hooks/hooks_constants/stale_comment_reference_blocker_constants.py +76 -0
  74. package/hooks/hooks_constants/state_description_blocker_constants.py +8 -0
  75. package/hooks/validation/post_tool_use_dispatcher.py +1 -1
  76. package/hooks/validation/test_post_tool_use_dispatcher.py +51 -35
  77. package/hooks/workflow/CLAUDE.md +2 -8
  78. package/package.json +1 -1
  79. package/rules/CLAUDE.md +5 -2
  80. package/rules/claude-md-orphan-file.md +5 -0
  81. package/rules/docstring-prose-matches-implementation.md +10 -1
  82. package/rules/env-var-table-code-drift.md +5 -0
  83. package/rules/es-exe-file-search.md +17 -0
  84. package/rules/no-historical-clutter.md +12 -1
  85. package/rules/orphan-css-class.md +5 -0
  86. package/rules/package-inventory-stale-entry.md +10 -0
  87. package/rules/paired-test-coverage.md +5 -0
  88. package/rules/plain-illustrative-docstrings.md +40 -1
  89. package/rules/verify-before-asking.md +7 -0
  90. package/rules/verify-runtime-state.md +40 -0
  91. package/rules/windows-filesystem-safe.md +8 -0
  92. package/rules/workers-done-before-complete.md +33 -0
  93. package/rules/workflow-substitution-slots.md +5 -0
  94. package/skills/CLAUDE.md +7 -2
  95. package/skills/autoconverge/SKILL.md +48 -61
  96. package/skills/autoconverge/reference/closing-report.md +6 -6
  97. package/skills/autoconverge/reference/convergence.md +17 -15
  98. package/skills/autoconverge/reference/gotchas.md +6 -3
  99. package/skills/autoconverge/workflow/autoconverge_report_constants/render_report_constants.py +2 -9
  100. package/skills/autoconverge/workflow/converge.contract.test.mjs +153 -10
  101. package/skills/autoconverge/workflow/converge.copilot-gate.test.mjs +55 -19
  102. package/skills/autoconverge/workflow/converge.merge-conflict.test.mjs +16 -9
  103. package/skills/autoconverge/workflow/converge.mjs +167 -106
  104. package/skills/autoconverge/workflow/render_report.py +7 -11
  105. package/skills/bugteam/CLAUDE.md +1 -1
  106. package/skills/bugteam/PROMPTS.md +7 -6
  107. package/skills/bugteam/SKILL.md +25 -72
  108. package/skills/bugteam/reference/CLAUDE.md +1 -3
  109. package/skills/bugteam/reference/README.md +1 -1
  110. package/skills/bugteam/reference/audit-and-teammates.md +1 -1
  111. package/skills/bugteam/reference/obstacles/fix-publish-summary.md +1 -1
  112. package/skills/bugteam/reference/team-setup.md +8 -7
  113. package/skills/bugteam/scripts/CLAUDE.md +0 -6
  114. package/skills/bugteam/scripts/README.md +0 -4
  115. package/skills/bugteam/scripts/bugteam_scripts_constants/CLAUDE.md +0 -1
  116. package/skills/code/SKILL.md +2 -0
  117. package/skills/copilot-review/CLAUDE.md +1 -1
  118. package/skills/copilot-review/SKILL.md +25 -23
  119. package/skills/everything-search/SKILL.md +5 -0
  120. package/skills/findbugs/CLAUDE.md +2 -2
  121. package/skills/findbugs/SKILL.md +22 -83
  122. package/skills/fixbugs/SKILL.md +2 -4
  123. package/skills/log-audit/CLAUDE.md +20 -0
  124. package/skills/log-audit/SKILL.md +68 -0
  125. package/skills/log-audit/reference/CLAUDE.md +9 -0
  126. package/skills/log-audit/reference/charter.md +52 -0
  127. package/skills/log-audit/scripts/CLAUDE.md +27 -0
  128. package/skills/log-audit/scripts/cluster_recurrences.py +261 -0
  129. package/skills/log-audit/scripts/collect_log_window.py +199 -0
  130. package/skills/log-audit/scripts/log_audit_constants/CLAUDE.md +12 -0
  131. package/skills/log-audit/scripts/log_audit_constants/cluster_recurrences_constants.py +23 -0
  132. package/skills/log-audit/scripts/log_audit_constants/collect_log_window_constants.py +24 -0
  133. package/skills/log-audit/scripts/log_audit_constants/mine_copilot_findings_constants.py +49 -0
  134. package/skills/log-audit/scripts/mine_copilot_findings.py +302 -0
  135. package/skills/log-audit/scripts/test_cluster_recurrences.py +160 -0
  136. package/skills/log-audit/scripts/test_collect_log_window.py +111 -0
  137. package/skills/log-audit/scripts/test_mine_copilot_findings.py +126 -0
  138. package/skills/monitor-open-prs/SKILL.md +2 -2
  139. package/skills/post-audit-findings/SKILL.md +84 -0
  140. package/skills/pr-converge/CLAUDE.md +2 -0
  141. package/skills/pr-converge/SKILL.md +72 -59
  142. package/skills/pr-converge/reference/CLAUDE.md +1 -1
  143. package/skills/pr-converge/reference/convergence-gates.md +16 -19
  144. package/skills/pr-converge/reference/examples.md +5 -5
  145. package/skills/pr-converge/reference/fix-protocol.md +16 -43
  146. package/skills/pr-converge/reference/obstacles/fix-publish-summary.md +1 -1
  147. package/skills/pr-converge/reference/per-tick.md +24 -45
  148. package/skills/pr-converge/reference/state-schema.md +15 -0
  149. package/skills/pr-converge/scripts/README.md +3 -5
  150. package/skills/pr-fix-protocol/SKILL.md +70 -0
  151. package/skills/pr-loop-lifecycle/SKILL.md +73 -0
  152. package/skills/{bugteam → pr-loop-lifecycle}/reference/teardown-publish-permissions.md +22 -24
  153. package/skills/pr-scope-resolve/SKILL.md +48 -0
  154. package/skills/qbug/CLAUDE.md +4 -4
  155. package/skills/qbug/SKILL.md +46 -144
  156. package/skills/qbug/test_qbug_skill_audit_schema.py +2 -2
  157. package/skills/qbug/test_qbug_skill_post_fix_audit.py +1 -1
  158. package/skills/reviewer-gates/SKILL.md +96 -0
  159. package/skills/session-log/CLAUDE.md +7 -7
  160. package/skills/session-log/SKILL.md +27 -44
  161. package/skills/test_markdown_link_integrity.py +103 -0
  162. package/commands/doc-gist.md +0 -16
  163. package/hooks/blocking/_md_to_html_blocker_test_support.py +0 -65
  164. package/hooks/blocking/conftest.py +0 -30
  165. package/hooks/blocking/md_path_exemptions.py +0 -224
  166. package/hooks/blocking/md_to_html_blocker.py +0 -155
  167. package/hooks/blocking/test_md_to_html_blocker_exemptions.py +0 -434
  168. package/hooks/blocking/test_md_to_html_blocker_extensions.py +0 -157
  169. package/hooks/blocking/test_md_to_html_blocker_path_resolution.py +0 -336
  170. package/hooks/hooks_constants/doc_gist_auto_publish_constants.py +0 -18
  171. package/hooks/hooks_constants/html_companion_constants.py +0 -20
  172. package/hooks/hooks_constants/md_to_html_blocker_constants.py +0 -76
  173. package/hooks/hooks_constants/test_md_to_html_blocker_constants.py +0 -125
  174. package/hooks/workflow/doc_gist_auto_publish.py +0 -144
  175. package/hooks/workflow/md_to_html_companion.py +0 -358
  176. package/hooks/workflow/test_doc_gist_auto_publish.py +0 -117
  177. package/hooks/workflow/test_md_to_html_companion.py +0 -613
  178. package/skills/bugteam/reference/audit-contract.md +0 -163
  179. package/skills/bugteam/scripts/_bugteam_permissions_common.py +0 -455
  180. package/skills/bugteam/scripts/bugteam_scripts_constants/claude_permissions_common_constants.py +0 -69
  181. package/skills/bugteam/scripts/grant_project_claude_permissions.py +0 -280
  182. package/skills/bugteam/scripts/revoke_project_claude_permissions.py +0 -266
  183. package/skills/bugteam/scripts/test__bugteam_permissions_common.py +0 -160
  184. package/skills/bugteam/scripts/test_agent_config_carveout.py +0 -356
  185. package/skills/bugteam/scripts/test_bugteam_permissions_common.py +0 -140
  186. package/skills/doc-gist/CLAUDE.md +0 -25
  187. package/skills/doc-gist/SKILL.md +0 -97
  188. package/skills/doc-gist/references/CLAUDE.md +0 -9
  189. package/skills/doc-gist/references/examples/01-exploration-code-approaches.html +0 -453
  190. package/skills/doc-gist/references/examples/02-exploration-visual-designs.html +0 -515
  191. package/skills/doc-gist/references/examples/03-code-review-pr.html +0 -638
  192. package/skills/doc-gist/references/examples/04-code-understanding.html +0 -491
  193. package/skills/doc-gist/references/examples/05-design-system.html +0 -629
  194. package/skills/doc-gist/references/examples/06-component-variants.html +0 -605
  195. package/skills/doc-gist/references/examples/07-prototype-animation.html +0 -455
  196. package/skills/doc-gist/references/examples/08-prototype-interaction.html +0 -396
  197. package/skills/doc-gist/references/examples/09-slide-deck.html +0 -592
  198. package/skills/doc-gist/references/examples/10-svg-illustrations.html +0 -492
  199. package/skills/doc-gist/references/examples/11-status-report.html +0 -528
  200. package/skills/doc-gist/references/examples/12-incident-report.html +0 -596
  201. package/skills/doc-gist/references/examples/13-flowchart-diagram.html +0 -395
  202. package/skills/doc-gist/references/examples/14-research-feature-explainer.html +0 -381
  203. package/skills/doc-gist/references/examples/15-research-concept-explainer.html +0 -368
  204. package/skills/doc-gist/references/examples/16-implementation-plan.html +0 -702
  205. package/skills/doc-gist/references/examples/17-pr-writeup.html +0 -595
  206. package/skills/doc-gist/references/examples/18-editor-triage-board.html +0 -573
  207. package/skills/doc-gist/references/examples/19-editor-feature-flags.html +0 -663
  208. package/skills/doc-gist/references/examples/20-editor-prompt-tuner.html +0 -722
  209. package/skills/doc-gist/references/examples/21-decision-signoff.html +0 -546
  210. package/skills/doc-gist/references/examples/CLAUDE.md +0 -25
  211. package/skills/doc-gist/references/examples/README.md +0 -5
  212. package/skills/doc-gist/scripts/CLAUDE.md +0 -27
  213. package/skills/doc-gist/scripts/doc_gist_scripts_constants/CLAUDE.md +0 -10
  214. package/skills/doc-gist/scripts/doc_gist_scripts_constants/gist_upload_constants.py +0 -16
  215. package/skills/doc-gist/scripts/gist_upload.py +0 -177
  216. package/skills/doc-gist/scripts/test_gist_upload.py +0 -51
  217. /package/skills/{doc-gist/scripts/doc_gist_scripts_constants → log-audit/scripts/log_audit_constants}/__init__.py +0 -0
@@ -1,396 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1" />
6
- <title>Birchline — Sidebar drag-to-reorder</title>
7
- <style>
8
- :root {
9
- --ivory: #FAF9F5;
10
- --slate: #141413;
11
- --clay: #D97757;
12
- --oat: #E3DACC;
13
- --olive: #788C5D;
14
- --gray-50: #F0EEE6;
15
- --gray-200: #D1CFC5;
16
- --gray-500: #87867F;
17
- --gray-800: #3D3D3A;
18
- --white: #ffffff;
19
- --serif: ui-serif, Georgia, "Times New Roman", serif;
20
- --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
21
- --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
22
- }
23
- * { box-sizing: border-box; }
24
- html, body {
25
- margin: 0;
26
- background: var(--ivory);
27
- color: var(--slate);
28
- font-family: var(--sans);
29
- font-size: 14px;
30
- line-height: 1.55;
31
- }
32
- .wrap {
33
- max-width: 1040px;
34
- margin: 0 auto;
35
- padding: 48px 32px 64px;
36
- }
37
- header { margin-bottom: 28px; }
38
- .eyebrow {
39
- font-family: var(--mono);
40
- font-size: 11px;
41
- letter-spacing: 0.08em;
42
- text-transform: uppercase;
43
- color: var(--gray-500);
44
- }
45
- h1 {
46
- font-family: var(--serif);
47
- font-weight: 500;
48
- font-size: 30px;
49
- letter-spacing: -0.01em;
50
- margin: 6px 0 4px;
51
- }
52
- .sub {
53
- color: var(--gray-500);
54
- max-width: 600px;
55
- }
56
- code.inline {
57
- font-family: var(--mono);
58
- font-size: 12px;
59
- background: var(--gray-50);
60
- border: 1.5px solid var(--gray-200);
61
- padding: 1px 5px;
62
- border-radius: 4px;
63
- }
64
-
65
- /* ---------- layout ---------- */
66
- .bench {
67
- display: grid;
68
- grid-template-columns: 300px 1fr;
69
- gap: 28px;
70
- align-items: start;
71
- }
72
-
73
- /* ---------- sidebar mock ---------- */
74
- .sidebar {
75
- width: 260px;
76
- background: var(--white);
77
- border: 1.5px solid var(--gray-200);
78
- border-radius: 12px;
79
- padding: 14px 10px;
80
- }
81
- .sidebar-title {
82
- font-family: var(--mono);
83
- font-size: 10px;
84
- letter-spacing: 0.1em;
85
- text-transform: uppercase;
86
- color: var(--gray-500);
87
- padding: 4px 10px 10px;
88
- }
89
- .list {
90
- position: relative;
91
- list-style: none;
92
- margin: 0;
93
- padding: 0;
94
- }
95
- .item {
96
- display: flex;
97
- align-items: center;
98
- gap: 10px;
99
- padding: 9px 10px;
100
- margin: 2px 0;
101
- border-radius: 8px;
102
- background: var(--white);
103
- cursor: grab;
104
- user-select: none;
105
- transition: background 120ms linear, transform 120ms ease-out, opacity 120ms linear;
106
- }
107
- .item:hover { background: var(--gray-50); }
108
- .item:hover .grip i { background: var(--gray-800); }
109
- .item.dragging {
110
- opacity: 0.35;
111
- transform: rotate(2deg);
112
- background: var(--gray-50);
113
- cursor: grabbing;
114
- }
115
- .item .label { font-size: 14px; color: var(--slate); }
116
- .item .count {
117
- margin-left: auto;
118
- font-family: var(--mono);
119
- font-size: 11px;
120
- color: var(--gray-500);
121
- }
122
-
123
- /* grip: 2 × 3 dot grid, pure css */
124
- .grip {
125
- flex: none;
126
- width: 10px;
127
- height: 16px;
128
- display: grid;
129
- grid-template-columns: repeat(2, 3px);
130
- grid-template-rows: repeat(3, 3px);
131
- gap: 3px;
132
- align-content: center;
133
- }
134
- .grip i {
135
- width: 3px;
136
- height: 3px;
137
- border-radius: 50%;
138
- background: var(--gray-200);
139
- transition: background 120ms linear;
140
- }
141
-
142
- /* drop indicator line */
143
- .indicator {
144
- position: absolute;
145
- left: 6px;
146
- right: 6px;
147
- height: 2px;
148
- background: var(--clay);
149
- border-radius: 2px;
150
- pointer-events: none;
151
- display: none;
152
- }
153
- .indicator::before {
154
- content: "";
155
- position: absolute;
156
- left: -5px;
157
- top: -3px;
158
- width: 8px;
159
- height: 8px;
160
- border-radius: 50%;
161
- background: var(--clay);
162
- }
163
- .indicator.on { display: block; }
164
-
165
- /* ---------- annotation panel ---------- */
166
- .notes {
167
- background: var(--white);
168
- border: 1.5px solid var(--gray-200);
169
- border-radius: 12px;
170
- padding: 22px 24px;
171
- }
172
- .notes h2 {
173
- font-family: var(--serif);
174
- font-weight: 500;
175
- font-size: 18px;
176
- margin: 0 0 6px;
177
- }
178
- .notes .lede {
179
- color: var(--gray-500);
180
- font-size: 13px;
181
- margin: 0 0 16px;
182
- }
183
- .notes ul {
184
- list-style: none;
185
- margin: 0;
186
- padding: 0;
187
- }
188
- .notes li {
189
- position: relative;
190
- padding: 10px 0 10px 22px;
191
- border-top: 1.5px solid var(--gray-50);
192
- font-size: 13px;
193
- color: var(--gray-800);
194
- }
195
- .notes li:first-child { border-top: none; }
196
- .notes li::before {
197
- content: "";
198
- position: absolute;
199
- left: 4px;
200
- top: 16px;
201
- width: 7px;
202
- height: 7px;
203
- border-radius: 2px;
204
- background: var(--clay);
205
- }
206
- .notes li b { color: var(--slate); font-weight: 600; }
207
-
208
- /* ---------- open questions ---------- */
209
- .questions {
210
- margin-top: 28px;
211
- background: var(--oat);
212
- border: 1.5px solid var(--gray-200);
213
- border-radius: 12px;
214
- padding: 20px 24px;
215
- }
216
- .questions h2 {
217
- font-family: var(--serif);
218
- font-weight: 500;
219
- font-size: 17px;
220
- margin: 0 0 12px;
221
- }
222
- .questions ol {
223
- margin: 0;
224
- padding-left: 20px;
225
- }
226
- .questions li {
227
- font-size: 13px;
228
- color: var(--gray-800);
229
- padding: 4px 0;
230
- }
231
- .questions li::marker {
232
- font-family: var(--mono);
233
- color: var(--olive);
234
- font-weight: 600;
235
- }
236
-
237
- .footnote {
238
- margin-top: 18px;
239
- font-family: var(--mono);
240
- font-size: 11px;
241
- color: var(--gray-500);
242
- }
243
- </style>
244
- </head>
245
- <body>
246
- <div class="wrap">
247
-
248
- <header>
249
- <div class="eyebrow">Birchline / prototype / interaction</div>
250
- <h1>Sidebar drag-to-reorder</h1>
251
- <p class="sub">
252
- Throwaway HTML so we can <em>feel</em> the reorder before porting it to
253
- React. Native <code class="inline">dragstart / dragover / drop</code>,
254
- ~40 lines of JS, no libraries. Grab a row by the dots and move it.
255
- </p>
256
- </header>
257
-
258
- <div class="bench">
259
-
260
- <div>
261
- <nav class="sidebar">
262
- <div class="sidebar-title">Views</div>
263
- <ul class="list" id="list">
264
- <li class="item" draggable="true">
265
- <span class="grip"><i></i><i></i><i></i><i></i><i></i><i></i></span>
266
- <span class="label">Inbox</span>
267
- <span class="count">14</span>
268
- </li>
269
- <li class="item" draggable="true">
270
- <span class="grip"><i></i><i></i><i></i><i></i><i></i><i></i></span>
271
- <span class="label">Today</span>
272
- <span class="count">3</span>
273
- </li>
274
- <li class="item" draggable="true">
275
- <span class="grip"><i></i><i></i><i></i><i></i><i></i><i></i></span>
276
- <span class="label">Upcoming</span>
277
- <span class="count">21</span>
278
- </li>
279
- <li class="item" draggable="true">
280
- <span class="grip"><i></i><i></i><i></i><i></i><i></i><i></i></span>
281
- <span class="label">Projects</span>
282
- <span class="count">8</span>
283
- </li>
284
- <li class="item" draggable="true">
285
- <span class="grip"><i></i><i></i><i></i><i></i><i></i><i></i></span>
286
- <span class="label">Archive</span>
287
- <span class="count"></span>
288
- </li>
289
- <li class="item" draggable="true">
290
- <span class="grip"><i></i><i></i><i></i><i></i><i></i><i></i></span>
291
- <span class="label">Trash</span>
292
- <span class="count"></span>
293
- </li>
294
- <div class="indicator" id="indicator"></div>
295
- </ul>
296
- </nav>
297
- <p class="footnote">Order persists in the DOM only — refresh to reset.</p>
298
- </div>
299
-
300
- <div>
301
- <section class="notes">
302
- <h2>What you're feeling</h2>
303
- <p class="lede">Design decisions baked into this prototype, so you can push back on them.</p>
304
- <ul>
305
- <li>
306
- <b>Drop indicator snaps to the nearest gap</b>, not the raw cursor Y.
307
- It only moves when you cross a row's midpoint — feels more decisive,
308
- less jittery.
309
- </li>
310
- <li>
311
- <b>Dragged row stays in place at 35% opacity</b> with a 2&deg; tilt.
312
- Keeping the ghost in the list preserves your sense of where you
313
- started; the tilt reads as "lifted."
314
- </li>
315
- <li>
316
- <b>Grip dots are the affordance, but the whole row is draggable.</b>
317
- Dots darken on hover to teach the gesture without forcing a
318
- tiny hit target.
319
- </li>
320
- <li>
321
- <b>No auto-scroll, no drop animation.</b> Left out on purpose so the
322
- core feel is easy to judge — say the word and we add them next.
323
- </li>
324
- </ul>
325
- </section>
326
-
327
- <section class="questions">
328
- <h2>Open questions</h2>
329
- <ol>
330
- <li>Should <b>Trash</b> (and maybe <b>Archive</b>) be pinned to the bottom and excluded from reordering?</li>
331
- <li>Do we want rows to <b>slide</b> to their new slot on drop, or is the instant snap acceptable?</li>
332
- <li>Keyboard path: is <code class="inline">Alt + Arrow</code> to move the focused row enough for the first ship?</li>
333
- </ol>
334
- </section>
335
- </div>
336
-
337
- </div>
338
- </div>
339
-
340
- <script>
341
- var list = document.getElementById('list');
342
- var indicator = document.getElementById('indicator');
343
- var dragging = null;
344
- var dropBefore = null; // node to insert before, or null = append
345
-
346
- list.addEventListener('dragstart', function (e) {
347
- var item = e.target.closest('.item');
348
- if (!item) return;
349
- dragging = item;
350
- item.classList.add('dragging');
351
- e.dataTransfer.effectAllowed = 'move';
352
- e.dataTransfer.setData('text/plain', '');
353
- });
354
-
355
- list.addEventListener('dragover', function (e) {
356
- if (!dragging) return;
357
- e.preventDefault();
358
- var siblings = Array.prototype.filter.call(
359
- list.children,
360
- function (el) { return el.classList && el.classList.contains('item'); }
361
- );
362
- dropBefore = null;
363
- for (var i = 0; i < siblings.length; i++) {
364
- var r = siblings[i].getBoundingClientRect();
365
- if (e.clientY < r.top + r.height / 2) { dropBefore = siblings[i]; break; }
366
- }
367
- var listRect = list.getBoundingClientRect();
368
- var edge = dropBefore
369
- ? dropBefore.getBoundingClientRect().top
370
- : siblings[siblings.length - 1].getBoundingClientRect().bottom;
371
- indicator.style.top = (edge - listRect.top - 1) + 'px';
372
- indicator.classList.add('on');
373
- });
374
-
375
- list.addEventListener('drop', function (e) {
376
- e.preventDefault();
377
- if (!dragging) return;
378
- if (dropBefore) list.insertBefore(dragging, dropBefore);
379
- else list.insertBefore(dragging, indicator);
380
- cleanup();
381
- });
382
-
383
- list.addEventListener('dragleave', function (e) {
384
- if (!list.contains(e.relatedTarget)) indicator.classList.remove('on');
385
- });
386
- document.addEventListener('dragend', cleanup);
387
-
388
- function cleanup() {
389
- if (dragging) dragging.classList.remove('dragging');
390
- dragging = null;
391
- dropBefore = null;
392
- indicator.classList.remove('on');
393
- }
394
- </script>
395
- </body>
396
- </html>