@youtyan/code-viewer 0.1.32 → 0.1.34
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.
- package/README.md +41 -0
- package/dist/code-viewer.js +1080 -351
- package/package.json +1 -1
- package/web/app.js +5944 -5477
- package/web/index.html +28 -0
- package/web/style.css +307 -0
package/web/index.html
CHANGED
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
<a class="app-menu-item" data-route="diff" href="/todif?from=HEAD&to=worktree">Diff Viewer</a>
|
|
29
29
|
</nav>
|
|
30
30
|
<div class="global-actions">
|
|
31
|
+
<button id="annotations-toggle" class="global-icon-action" title="code annotations" aria-label="code annotations">💬<span id="annotations-count" hidden></span></button>
|
|
31
32
|
<button id="viewer-settings" class="global-icon-action" title="viewer settings" aria-label="viewer settings"></button>
|
|
32
33
|
<button id="theme" title="toggle theme">🌗</button>
|
|
33
34
|
<span id="status" class="status"></span>
|
|
@@ -136,6 +137,33 @@
|
|
|
136
137
|
</div>
|
|
137
138
|
</div>
|
|
138
139
|
|
|
140
|
+
<aside id="annotation-panel" hidden>
|
|
141
|
+
<div class="annotation-panel-head">
|
|
142
|
+
<strong>Code annotations</strong>
|
|
143
|
+
<label class="annotation-follow-label" title="jump to new annotations as they arrive">
|
|
144
|
+
<input type="checkbox" id="annotation-follow" checked /> follow
|
|
145
|
+
</label>
|
|
146
|
+
<button id="annotation-clear" type="button" title="delete all annotations">clear</button>
|
|
147
|
+
<button id="annotation-panel-close" type="button">close</button>
|
|
148
|
+
</div>
|
|
149
|
+
<div id="annotation-detail" hidden>
|
|
150
|
+
<div class="annotation-detail-head">
|
|
151
|
+
<span id="annotation-detail-session"></span>
|
|
152
|
+
<span id="annotation-detail-step"></span>
|
|
153
|
+
<button id="annotation-detail-prev" type="button" title="previous annotation">‹</button>
|
|
154
|
+
<button id="annotation-detail-next" type="button" title="next annotation">›</button>
|
|
155
|
+
<button id="annotation-detail-close" type="button">close</button>
|
|
156
|
+
</div>
|
|
157
|
+
<a id="annotation-detail-location" href="#"></a>
|
|
158
|
+
<div id="annotation-detail-body" class="markdown-body"></div>
|
|
159
|
+
</div>
|
|
160
|
+
<div class="annotation-list-head">
|
|
161
|
+
<strong>Sessions</strong>
|
|
162
|
+
<span id="annotation-list-count"></span>
|
|
163
|
+
</div>
|
|
164
|
+
<div id="annotation-sessions"></div>
|
|
165
|
+
</aside>
|
|
166
|
+
|
|
139
167
|
<main id="content">
|
|
140
168
|
<div id="empty" class="empty hidden">
|
|
141
169
|
<div class="emoji">✨</div>
|
package/web/style.css
CHANGED
|
@@ -1640,6 +1640,12 @@ body.gdp-help-page #content {
|
|
|
1640
1640
|
|
|
1641
1641
|
#diff > *:first-child { margin-top: 0; }
|
|
1642
1642
|
|
|
1643
|
+
body:not(.gdp-file-detail-page) #diff::after {
|
|
1644
|
+
content: "";
|
|
1645
|
+
display: block;
|
|
1646
|
+
height: calc(100vh - var(--chrome-h) - 40px);
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1643
1649
|
.empty {
|
|
1644
1650
|
display: flex; flex-direction: column; align-items: center; justify-content: center;
|
|
1645
1651
|
padding: 80px 16px; color: var(--fg-muted); text-align: center;
|
|
@@ -3964,3 +3970,304 @@ body.gdp-file-detail-page #empty {
|
|
|
3964
3970
|
font-style: italic;
|
|
3965
3971
|
background: var(--bg-soft);
|
|
3966
3972
|
}
|
|
3973
|
+
|
|
3974
|
+
/* ---- Code annotations (AI walkthrough) ---- */
|
|
3975
|
+
#annotations-toggle {
|
|
3976
|
+
position: relative;
|
|
3977
|
+
}
|
|
3978
|
+
#annotations-count {
|
|
3979
|
+
position: absolute;
|
|
3980
|
+
top: -4px;
|
|
3981
|
+
right: -6px;
|
|
3982
|
+
min-width: 16px;
|
|
3983
|
+
padding: 0 4px;
|
|
3984
|
+
border-radius: 8px;
|
|
3985
|
+
background: var(--accent);
|
|
3986
|
+
color: var(--fg-onemphasis);
|
|
3987
|
+
font-size: 10px;
|
|
3988
|
+
line-height: 16px;
|
|
3989
|
+
text-align: center;
|
|
3990
|
+
}
|
|
3991
|
+
|
|
3992
|
+
#annotation-panel {
|
|
3993
|
+
position: fixed;
|
|
3994
|
+
right: 0;
|
|
3995
|
+
top: var(--chrome-h);
|
|
3996
|
+
bottom: 0;
|
|
3997
|
+
width: min(380px, calc(100vw - 32px));
|
|
3998
|
+
z-index: 45;
|
|
3999
|
+
display: flex;
|
|
4000
|
+
flex-direction: column;
|
|
4001
|
+
border-left: 1px solid var(--border);
|
|
4002
|
+
background: var(--bg);
|
|
4003
|
+
box-shadow: var(--shadow-md);
|
|
4004
|
+
}
|
|
4005
|
+
#annotation-panel[hidden],
|
|
4006
|
+
#annotation-detail[hidden] {
|
|
4007
|
+
display: none;
|
|
4008
|
+
}
|
|
4009
|
+
/* Pages without the diff topbar start the panel right below the header. */
|
|
4010
|
+
body.gdp-repo-page #annotation-panel,
|
|
4011
|
+
body.gdp-file-detail-page #annotation-panel,
|
|
4012
|
+
body.gdp-help-page #annotation-panel {
|
|
4013
|
+
top: var(--global-header-h);
|
|
4014
|
+
}
|
|
4015
|
+
/* Keep code readable next to the panel instead of underneath it. */
|
|
4016
|
+
body.annotation-panel-open #content {
|
|
4017
|
+
margin-right: min(380px, calc(100vw - 32px));
|
|
4018
|
+
}
|
|
4019
|
+
.annotation-panel-head {
|
|
4020
|
+
display: flex;
|
|
4021
|
+
align-items: center;
|
|
4022
|
+
gap: 8px;
|
|
4023
|
+
padding: 10px 12px;
|
|
4024
|
+
border-bottom: 1px solid var(--border);
|
|
4025
|
+
}
|
|
4026
|
+
.annotation-panel-head strong {
|
|
4027
|
+
flex: 1;
|
|
4028
|
+
font-size: 13px;
|
|
4029
|
+
}
|
|
4030
|
+
.annotation-follow-label {
|
|
4031
|
+
display: inline-flex;
|
|
4032
|
+
align-items: center;
|
|
4033
|
+
gap: 4px;
|
|
4034
|
+
font-size: 12px;
|
|
4035
|
+
color: var(--fg-muted);
|
|
4036
|
+
white-space: nowrap;
|
|
4037
|
+
cursor: pointer;
|
|
4038
|
+
}
|
|
4039
|
+
#annotation-clear,
|
|
4040
|
+
#annotation-panel-close {
|
|
4041
|
+
border: 1px solid var(--border);
|
|
4042
|
+
border-radius: 6px;
|
|
4043
|
+
background: var(--bg-soft);
|
|
4044
|
+
color: var(--fg-muted);
|
|
4045
|
+
font-size: 12px;
|
|
4046
|
+
padding: 2px 8px;
|
|
4047
|
+
cursor: pointer;
|
|
4048
|
+
}
|
|
4049
|
+
#annotation-clear:hover,
|
|
4050
|
+
#annotation-panel-close:hover {
|
|
4051
|
+
color: var(--danger);
|
|
4052
|
+
border-color: var(--danger);
|
|
4053
|
+
}
|
|
4054
|
+
#annotation-sessions {
|
|
4055
|
+
flex: 1;
|
|
4056
|
+
overflow-y: auto;
|
|
4057
|
+
padding: 8px 12px 16px;
|
|
4058
|
+
}
|
|
4059
|
+
.annotation-list-head {
|
|
4060
|
+
display: flex;
|
|
4061
|
+
align-items: baseline;
|
|
4062
|
+
justify-content: space-between;
|
|
4063
|
+
gap: 8px;
|
|
4064
|
+
padding: 8px 12px 0;
|
|
4065
|
+
}
|
|
4066
|
+
.annotation-list-head strong {
|
|
4067
|
+
font-size: 12px;
|
|
4068
|
+
}
|
|
4069
|
+
#annotation-list-count {
|
|
4070
|
+
color: var(--fg-subtle);
|
|
4071
|
+
font-size: 11px;
|
|
4072
|
+
white-space: nowrap;
|
|
4073
|
+
}
|
|
4074
|
+
.annotation-empty {
|
|
4075
|
+
color: var(--fg-subtle);
|
|
4076
|
+
font-size: 12px;
|
|
4077
|
+
}
|
|
4078
|
+
.annotation-session {
|
|
4079
|
+
margin-bottom: 14px;
|
|
4080
|
+
}
|
|
4081
|
+
.annotation-session-head {
|
|
4082
|
+
display: flex;
|
|
4083
|
+
align-items: center;
|
|
4084
|
+
gap: 6px;
|
|
4085
|
+
margin: 6px 0;
|
|
4086
|
+
}
|
|
4087
|
+
.annotation-session-select {
|
|
4088
|
+
flex: 1;
|
|
4089
|
+
border: 0;
|
|
4090
|
+
background: none;
|
|
4091
|
+
color: inherit;
|
|
4092
|
+
font: inherit;
|
|
4093
|
+
font-size: 12px;
|
|
4094
|
+
font-weight: 600;
|
|
4095
|
+
text-align: left;
|
|
4096
|
+
padding: 2px 4px;
|
|
4097
|
+
border-radius: 6px;
|
|
4098
|
+
cursor: pointer;
|
|
4099
|
+
overflow: hidden;
|
|
4100
|
+
text-overflow: ellipsis;
|
|
4101
|
+
white-space: nowrap;
|
|
4102
|
+
}
|
|
4103
|
+
.annotation-session-select:hover {
|
|
4104
|
+
background: var(--accent-subtle);
|
|
4105
|
+
}
|
|
4106
|
+
.annotation-session.active .annotation-session-select {
|
|
4107
|
+
background: var(--accent-subtle);
|
|
4108
|
+
color: var(--accent);
|
|
4109
|
+
}
|
|
4110
|
+
.annotation-entries {
|
|
4111
|
+
list-style: none;
|
|
4112
|
+
margin: 0;
|
|
4113
|
+
padding: 0;
|
|
4114
|
+
counter-reset: annotation-step;
|
|
4115
|
+
}
|
|
4116
|
+
.annotation-entries li {
|
|
4117
|
+
display: flex;
|
|
4118
|
+
align-items: flex-start;
|
|
4119
|
+
gap: 4px;
|
|
4120
|
+
border-radius: 6px;
|
|
4121
|
+
counter-increment: annotation-step;
|
|
4122
|
+
}
|
|
4123
|
+
.annotation-entries li.active {
|
|
4124
|
+
background: var(--accent-subtle);
|
|
4125
|
+
}
|
|
4126
|
+
.annotation-entry-open {
|
|
4127
|
+
flex: 1;
|
|
4128
|
+
display: block;
|
|
4129
|
+
text-align: left;
|
|
4130
|
+
border: 0;
|
|
4131
|
+
background: none;
|
|
4132
|
+
padding: 5px 6px;
|
|
4133
|
+
cursor: pointer;
|
|
4134
|
+
color: inherit;
|
|
4135
|
+
min-width: 0;
|
|
4136
|
+
}
|
|
4137
|
+
.annotation-entry-open::before {
|
|
4138
|
+
content: counter(annotation-step) ". ";
|
|
4139
|
+
color: var(--fg-subtle);
|
|
4140
|
+
font-size: 11px;
|
|
4141
|
+
}
|
|
4142
|
+
.annotation-entry-location {
|
|
4143
|
+
font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
|
|
4144
|
+
font-size: 11px;
|
|
4145
|
+
color: var(--accent);
|
|
4146
|
+
word-break: break-all;
|
|
4147
|
+
}
|
|
4148
|
+
.annotation-entry-summary {
|
|
4149
|
+
display: block;
|
|
4150
|
+
font-size: 12px;
|
|
4151
|
+
color: var(--fg-muted);
|
|
4152
|
+
overflow: hidden;
|
|
4153
|
+
text-overflow: ellipsis;
|
|
4154
|
+
white-space: nowrap;
|
|
4155
|
+
}
|
|
4156
|
+
.annotation-delete {
|
|
4157
|
+
border: 1px solid transparent;
|
|
4158
|
+
border-radius: 6px;
|
|
4159
|
+
background: transparent;
|
|
4160
|
+
color: var(--fg-subtle);
|
|
4161
|
+
font-size: 11px;
|
|
4162
|
+
cursor: pointer;
|
|
4163
|
+
padding: 3px 6px;
|
|
4164
|
+
}
|
|
4165
|
+
.annotation-delete:hover {
|
|
4166
|
+
color: var(--danger);
|
|
4167
|
+
border-color: var(--danger);
|
|
4168
|
+
}
|
|
4169
|
+
|
|
4170
|
+
#annotation-detail {
|
|
4171
|
+
flex: none;
|
|
4172
|
+
display: flex;
|
|
4173
|
+
flex-direction: column;
|
|
4174
|
+
max-height: 55%;
|
|
4175
|
+
border-bottom: 1px solid var(--border);
|
|
4176
|
+
background: var(--bg-soft);
|
|
4177
|
+
}
|
|
4178
|
+
.annotation-detail-head {
|
|
4179
|
+
display: flex;
|
|
4180
|
+
align-items: center;
|
|
4181
|
+
gap: 6px;
|
|
4182
|
+
padding: 8px 10px;
|
|
4183
|
+
}
|
|
4184
|
+
#annotation-detail-session {
|
|
4185
|
+
flex: 1;
|
|
4186
|
+
font-size: 12px;
|
|
4187
|
+
font-weight: 600;
|
|
4188
|
+
overflow: hidden;
|
|
4189
|
+
text-overflow: ellipsis;
|
|
4190
|
+
white-space: nowrap;
|
|
4191
|
+
}
|
|
4192
|
+
#annotation-detail-step {
|
|
4193
|
+
font-size: 11px;
|
|
4194
|
+
color: var(--fg-subtle);
|
|
4195
|
+
}
|
|
4196
|
+
#annotation-detail-prev,
|
|
4197
|
+
#annotation-detail-next,
|
|
4198
|
+
#annotation-detail-close {
|
|
4199
|
+
border: 1px solid var(--border);
|
|
4200
|
+
border-radius: 6px;
|
|
4201
|
+
background: var(--bg);
|
|
4202
|
+
color: var(--fg-muted);
|
|
4203
|
+
font-size: 13px;
|
|
4204
|
+
line-height: 1;
|
|
4205
|
+
padding: 2px 8px;
|
|
4206
|
+
cursor: pointer;
|
|
4207
|
+
}
|
|
4208
|
+
#annotation-detail-prev:disabled,
|
|
4209
|
+
#annotation-detail-next:disabled {
|
|
4210
|
+
opacity: 0.4;
|
|
4211
|
+
cursor: default;
|
|
4212
|
+
}
|
|
4213
|
+
#annotation-detail-location {
|
|
4214
|
+
display: block;
|
|
4215
|
+
padding: 0 12px;
|
|
4216
|
+
font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
|
|
4217
|
+
font-size: 11px;
|
|
4218
|
+
color: var(--accent);
|
|
4219
|
+
text-decoration: none;
|
|
4220
|
+
word-break: break-all;
|
|
4221
|
+
}
|
|
4222
|
+
#annotation-detail-location:hover {
|
|
4223
|
+
text-decoration: underline;
|
|
4224
|
+
}
|
|
4225
|
+
#annotation-detail-body {
|
|
4226
|
+
overflow-y: auto;
|
|
4227
|
+
overflow-x: hidden;
|
|
4228
|
+
padding: 8px 12px 12px;
|
|
4229
|
+
font-size: 13px;
|
|
4230
|
+
}
|
|
4231
|
+
#annotation-detail-body pre {
|
|
4232
|
+
max-width: 100%;
|
|
4233
|
+
overflow-x: auto;
|
|
4234
|
+
}
|
|
4235
|
+
.annotation-detail-title {
|
|
4236
|
+
display: block;
|
|
4237
|
+
margin-bottom: 6px;
|
|
4238
|
+
}
|
|
4239
|
+
/* Inline annotation rows under the annotated code line */
|
|
4240
|
+
.gdp-annotation-row td {
|
|
4241
|
+
padding: 0;
|
|
4242
|
+
background: var(--bg-soft);
|
|
4243
|
+
}
|
|
4244
|
+
.gdp-annotation-inline {
|
|
4245
|
+
margin: 4px 8px;
|
|
4246
|
+
padding: 8px 12px;
|
|
4247
|
+
border: 1px solid var(--border);
|
|
4248
|
+
border-left: 3px solid var(--accent);
|
|
4249
|
+
border-radius: 6px;
|
|
4250
|
+
background: var(--bg);
|
|
4251
|
+
font-size: 13px;
|
|
4252
|
+
font-family:
|
|
4253
|
+
-apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica,
|
|
4254
|
+
Arial, sans-serif;
|
|
4255
|
+
line-height: 1.5;
|
|
4256
|
+
white-space: normal;
|
|
4257
|
+
word-break: break-word;
|
|
4258
|
+
}
|
|
4259
|
+
.gdp-annotation-row.active .gdp-annotation-inline {
|
|
4260
|
+
border-left-color: var(--attn);
|
|
4261
|
+
box-shadow: 0 0 0 1px var(--attn) inset;
|
|
4262
|
+
}
|
|
4263
|
+
.gdp-annotation-inline-title {
|
|
4264
|
+
display: block;
|
|
4265
|
+
margin-bottom: 6px;
|
|
4266
|
+
}
|
|
4267
|
+
.gdp-annotation-inline-body pre {
|
|
4268
|
+
max-width: 100%;
|
|
4269
|
+
overflow-x: auto;
|
|
4270
|
+
}
|
|
4271
|
+
.gdp-annotation-inline-body p:last-child {
|
|
4272
|
+
margin-bottom: 0;
|
|
4273
|
+
}
|