@astryx-vue/lab 0.1.1 → 0.2.1
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 +1 -0
- package/dist/index.d.ts +278 -15
- package/dist/index.js +1546 -31
- package/lab.css +1 -0
- package/package.json +3 -3
- package/styles/diff-viewer.css +340 -0
package/lab.css
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryx-vue/lab",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"description": "Astryx lab components for Vue 3 — experimental components that may change. Ships only under the canary dist-tag.",
|
|
6
6
|
"author": "ShenQingchuan",
|
|
7
7
|
"license": "MIT",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
],
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"vue": "^3.5.0",
|
|
56
|
-
"@astryx-vue/core": "^0.
|
|
56
|
+
"@astryx-vue/core": "^0.7.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/node": "26.6.4",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"unplugin-vue": "8.0.0",
|
|
65
65
|
"vue": "3.5.43",
|
|
66
66
|
"vue-tsc": "3.3.12",
|
|
67
|
-
"@astryx-vue/core": "^0.
|
|
67
|
+
"@astryx-vue/core": "^0.7.0"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"build": "tsdown",
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
@layer astryx.reset, astryx.tokens, astryx.base, astryx.components, astryx.overrides;
|
|
2
|
+
|
|
3
|
+
@layer astryx.components {
|
|
4
|
+
/*
|
|
5
|
+
* 文件级 diff:表头是路径、状态、增删行数和可折叠开关,主体是按 hunk
|
|
6
|
+
* 排布的表格。颜色都走 CodeBlock 的 diff 槽位,同一套语法主题能同时
|
|
7
|
+
* 给 CodeBlock 和 DiffViewer 上色。
|
|
8
|
+
*/
|
|
9
|
+
.astryx-diff-viewer {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
min-width: 0;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
border: var(--astryx-border-width, 1px) solid var(--astryx-color-border, light-dark(#00000014, #ffffff1a));
|
|
15
|
+
border-radius: var(--astryx-radius-element, 0.625rem);
|
|
16
|
+
background-color: var(--astryx-code-block-background, var(--astryx-color-background-surface, light-dark(#ffffff, #262626)));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.astryx-diff-viewer__header {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
gap: var(--astryx-spacing-2, 8px);
|
|
23
|
+
min-width: 0;
|
|
24
|
+
padding-block: var(--astryx-spacing-2, 8px);
|
|
25
|
+
padding-inline: var(--astryx-spacing-3, 12px);
|
|
26
|
+
background-color: var(--astryx-color-background-surface, light-dark(#ffffff, #262626));
|
|
27
|
+
color: var(--astryx-color-text-primary, light-dark(#171717, #fafafa));
|
|
28
|
+
font-size: var(--astryx-text-supporting-size, 0.75rem);
|
|
29
|
+
line-height: var(--astryx-text-supporting-leading, 1.6667);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.astryx-diff-viewer__header--divided {
|
|
33
|
+
border-block-end: var(--astryx-border-width, 1px) solid var(--astryx-color-border, light-dark(#00000014, #ffffff1a));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.astryx-diff-viewer__toggle {
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
gap: var(--astryx-spacing-1, 4px);
|
|
40
|
+
min-width: 0;
|
|
41
|
+
margin: 0;
|
|
42
|
+
padding: 0;
|
|
43
|
+
border: 0;
|
|
44
|
+
border-radius: var(--astryx-radius-element, 0.625rem);
|
|
45
|
+
background: transparent;
|
|
46
|
+
color: inherit;
|
|
47
|
+
font: inherit;
|
|
48
|
+
text-align: start;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.astryx-diff-viewer__toggle:focus-visible,
|
|
53
|
+
.astryx-diff-viewer__gutter-button:focus-visible {
|
|
54
|
+
outline: 2px solid var(--astryx-color-text-primary, light-dark(#171717, #fafafa));
|
|
55
|
+
outline-offset: 2px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.astryx-diff-viewer__chevron {
|
|
59
|
+
display: inline-flex;
|
|
60
|
+
flex-shrink: 0;
|
|
61
|
+
color: var(--astryx-color-icon-secondary, light-dark(#525252, #9e9e9e));
|
|
62
|
+
transition: transform var(--astryx-duration-fast-max, 165ms) var(--astryx-ease-standard, cubic-bezier(0.24, 1, 0.4, 1));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.astryx-diff-viewer__chevron--expanded {
|
|
66
|
+
transform: rotate(90deg);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.astryx-diff-viewer__path {
|
|
70
|
+
min-width: 0;
|
|
71
|
+
overflow: hidden;
|
|
72
|
+
font-family: var(--astryx-font-family-code, monospace);
|
|
73
|
+
font-weight: var(--astryx-font-weight-medium, 500);
|
|
74
|
+
text-overflow: ellipsis;
|
|
75
|
+
white-space: nowrap;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.astryx-diff-viewer__stats {
|
|
79
|
+
display: inline-flex;
|
|
80
|
+
flex-shrink: 0;
|
|
81
|
+
gap: var(--astryx-spacing-1, 4px);
|
|
82
|
+
font-family: var(--astryx-font-family-code, monospace);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.astryx-diff-viewer__stat-added {
|
|
86
|
+
color: var(--astryx-color-text-green, light-dark(#0b5615, #a4d6a3));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.astryx-diff-viewer__stat-removed {
|
|
90
|
+
color: var(--astryx-color-text-red, light-dark(#8a0011, #ffc4be));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.astryx-diff-viewer__header-end {
|
|
94
|
+
display: flex;
|
|
95
|
+
flex-shrink: 0;
|
|
96
|
+
align-items: center;
|
|
97
|
+
gap: var(--astryx-spacing-2, 8px);
|
|
98
|
+
margin-inline-start: auto;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.astryx-diff-viewer__message {
|
|
102
|
+
padding-block: var(--astryx-spacing-3, 12px);
|
|
103
|
+
padding-inline: var(--astryx-spacing-4, 16px);
|
|
104
|
+
color: var(--astryx-color-text-secondary, light-dark(#474747, #9e9e9e));
|
|
105
|
+
font-size: var(--astryx-text-supporting-size, 0.75rem);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* 代码区在 RTL 页面里也保持从左到右,和代码编辑器一致。 */
|
|
109
|
+
.astryx-diff-viewer__viewport {
|
|
110
|
+
direction: ltr;
|
|
111
|
+
min-width: 0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.astryx-diff-viewer__content {
|
|
115
|
+
min-width: 0;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.astryx-diff-viewer__table {
|
|
119
|
+
width: max-content;
|
|
120
|
+
min-width: 100%;
|
|
121
|
+
border-collapse: collapse;
|
|
122
|
+
border-spacing: 0;
|
|
123
|
+
color: var(--astryx-code-syntax-variable, #111111);
|
|
124
|
+
font-family: var(--astryx-font-family-code, monospace);
|
|
125
|
+
font-size: var(--astryx-text-code-size, 0.875rem);
|
|
126
|
+
line-height: var(--astryx-text-code-leading, 1.4286);
|
|
127
|
+
tab-size: 2;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.astryx-diff-viewer__table--wrapped {
|
|
131
|
+
width: 100%;
|
|
132
|
+
table-layout: fixed;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.astryx-diff-viewer__gutter-col {
|
|
136
|
+
width: calc(var(--astryx-diff-viewer-gutter-width, 2ch) + 2 * var(--astryx-spacing-2, 8px));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.astryx-diff-viewer__marker-col {
|
|
140
|
+
width: calc(1ch + var(--astryx-spacing-1, 4px) + var(--astryx-spacing-2, 8px));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.astryx-diff-viewer__gutter {
|
|
144
|
+
padding: 0 var(--astryx-spacing-2, 8px);
|
|
145
|
+
color: var(--astryx-code-syntax-punctuation, #6a6a6a);
|
|
146
|
+
text-align: end;
|
|
147
|
+
vertical-align: top;
|
|
148
|
+
white-space: nowrap;
|
|
149
|
+
user-select: none;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.astryx-diff-viewer__gutter-button {
|
|
153
|
+
display: inline;
|
|
154
|
+
margin: 0;
|
|
155
|
+
padding: 0;
|
|
156
|
+
border: 0;
|
|
157
|
+
border-radius: var(--astryx-radius-inner, 0.375rem);
|
|
158
|
+
background: transparent;
|
|
159
|
+
color: inherit;
|
|
160
|
+
font: inherit;
|
|
161
|
+
cursor: pointer;
|
|
162
|
+
text-decoration: none;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.astryx-diff-viewer__gutter-button:hover {
|
|
166
|
+
text-decoration: underline;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.astryx-diff-viewer__marker {
|
|
170
|
+
padding: 0 var(--astryx-spacing-2, 8px) 0 var(--astryx-spacing-1, 4px);
|
|
171
|
+
color: var(--astryx-color-text-secondary, light-dark(#474747, #9e9e9e));
|
|
172
|
+
vertical-align: top;
|
|
173
|
+
white-space: pre;
|
|
174
|
+
user-select: none;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.astryx-diff-viewer__code {
|
|
178
|
+
padding: 0 var(--astryx-spacing-4, 16px) 0 0;
|
|
179
|
+
text-align: start;
|
|
180
|
+
vertical-align: top;
|
|
181
|
+
white-space: pre;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.astryx-diff-viewer__code--wrapped {
|
|
185
|
+
white-space: pre-wrap;
|
|
186
|
+
word-break: normal;
|
|
187
|
+
overflow-wrap: anywhere;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/* 分栏时旧文件一侧负责画中间的分隔线。 */
|
|
191
|
+
.astryx-diff-viewer__code--old {
|
|
192
|
+
border-inline-end: var(--astryx-border-width, 1px) solid var(--astryx-color-border, light-dark(#00000014, #ffffff1a));
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.astryx-diff-viewer__gutter.is-added,
|
|
196
|
+
.astryx-diff-viewer__marker.is-added,
|
|
197
|
+
.astryx-diff-viewer__code.is-added {
|
|
198
|
+
background-color: var(--astryx-code-syntax-added, color-mix(in srgb, var(--astryx-color-success-muted, #bbf7d0) 25%, transparent));
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.astryx-diff-viewer__gutter.is-removed,
|
|
202
|
+
.astryx-diff-viewer__marker.is-removed,
|
|
203
|
+
.astryx-diff-viewer__code.is-removed {
|
|
204
|
+
background-color: var(--astryx-code-syntax-removed, color-mix(in srgb, var(--astryx-color-error-muted, #fecaca) 25%, transparent));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.astryx-diff-viewer__gutter.is-added,
|
|
208
|
+
.astryx-diff-viewer__marker.is-added {
|
|
209
|
+
color: var(--astryx-code-syntax-added-marker, var(--astryx-color-text-green, #0b5615));
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.astryx-diff-viewer__gutter.is-removed,
|
|
213
|
+
.astryx-diff-viewer__marker.is-removed {
|
|
214
|
+
color: var(--astryx-code-syntax-removed-marker, var(--astryx-color-text-red, #8a0011));
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.astryx-diff-viewer__gutter.is-filler,
|
|
218
|
+
.astryx-diff-viewer__marker.is-filler,
|
|
219
|
+
.astryx-diff-viewer__code.is-filler {
|
|
220
|
+
background-color: var(--astryx-code-syntax-diff-header, var(--astryx-color-background-muted, #f5f5f5));
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.astryx-diff-viewer__hunk {
|
|
224
|
+
padding: var(--astryx-spacing-1, 4px) var(--astryx-spacing-3, 12px);
|
|
225
|
+
border-block: var(--astryx-border-width, 1px) solid var(--astryx-color-border, light-dark(#00000014, #ffffff1a));
|
|
226
|
+
background-color: var(--astryx-code-syntax-diff-header, var(--astryx-color-background-muted, #f5f5f5));
|
|
227
|
+
color: var(--astryx-code-syntax-punctuation, #6a6a6a);
|
|
228
|
+
white-space: pre;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.astryx-diff-viewer__ltr {
|
|
232
|
+
direction: ltr;
|
|
233
|
+
unicode-bidi: isolate;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/*
|
|
237
|
+
* 行内高亮:和行底色用同一档颜色。行底色本身带透明度,叠一层后
|
|
238
|
+
* 变化的那几个词会更实,没有底色时也仍然看得见。
|
|
239
|
+
*/
|
|
240
|
+
.astryx-diff-viewer__change {
|
|
241
|
+
border-radius: var(--astryx-radius-inner, 0.375rem);
|
|
242
|
+
box-decoration-break: clone;
|
|
243
|
+
-webkit-box-decoration-break: clone;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.astryx-diff-viewer__change[data-kind='added'] {
|
|
247
|
+
background-color: var(--astryx-code-syntax-added, color-mix(in srgb, var(--astryx-color-success-muted, #bbf7d0) 25%, transparent));
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.astryx-diff-viewer__change[data-kind='removed'] {
|
|
251
|
+
background-color: var(--astryx-code-syntax-removed, color-mix(in srgb, var(--astryx-color-error-muted, #fecaca) 25%, transparent));
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.astryx-diff-viewer__annotation {
|
|
255
|
+
padding: var(--astryx-spacing-2, 8px) var(--astryx-spacing-3, 12px);
|
|
256
|
+
border-block: var(--astryx-border-width, 1px) solid var(--astryx-color-border, light-dark(#00000014, #ffffff1a));
|
|
257
|
+
background-color: var(--astryx-color-background-surface, light-dark(#ffffff, #262626));
|
|
258
|
+
color: var(--astryx-color-text-primary, light-dark(#171717, #fafafa));
|
|
259
|
+
font-family: var(--astryx-font-family-body, inherit);
|
|
260
|
+
font-size: var(--astryx-text-body-size, 0.875rem);
|
|
261
|
+
line-height: var(--astryx-text-body-leading, 1.5);
|
|
262
|
+
vertical-align: top;
|
|
263
|
+
white-space: normal;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/*
|
|
267
|
+
* 注释内容跟随页面方向;它仍然待在从左到右的代码区里,跟着代码一起
|
|
268
|
+
* 横向滚动。inline-size containment 防止长注释把表格撑得更宽。
|
|
269
|
+
*/
|
|
270
|
+
.astryx-diff-viewer__annotation-content {
|
|
271
|
+
contain: inline-size;
|
|
272
|
+
overflow-wrap: anywhere;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
:dir(rtl) .astryx-diff-viewer__annotation-content {
|
|
276
|
+
direction: rtl;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/*
|
|
280
|
+
* 语法 token 的类名和 CodeBlock 共用。这里再声明一遍,是为了让只引
|
|
281
|
+
* DiffViewer 的样式、没有引 core CodeBlock 样式的用户也能看到高亮。
|
|
282
|
+
*/
|
|
283
|
+
.astryx-diff-viewer .astryx-token-keyword {
|
|
284
|
+
color: var(--astryx-code-syntax-keyword, #6b187c);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.astryx-diff-viewer .astryx-token-string {
|
|
288
|
+
color: var(--astryx-code-syntax-string, #0b5615);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.astryx-diff-viewer .astryx-token-comment {
|
|
292
|
+
color: var(--astryx-code-syntax-comment, #6a6a6a);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.astryx-diff-viewer .astryx-token-number {
|
|
296
|
+
color: var(--astryx-code-syntax-number, #733100);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.astryx-diff-viewer .astryx-token-function {
|
|
300
|
+
color: var(--astryx-code-syntax-function, #00458c);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.astryx-diff-viewer .astryx-token-type {
|
|
304
|
+
color: var(--astryx-code-syntax-type, #6b187c);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.astryx-diff-viewer .astryx-token-tag {
|
|
308
|
+
color: var(--astryx-code-syntax-tag, #8a0011);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.astryx-diff-viewer .astryx-token-attribute {
|
|
312
|
+
color: var(--astryx-code-syntax-attribute, #584400);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.astryx-diff-viewer .astryx-token-property {
|
|
316
|
+
color: var(--astryx-code-syntax-property, #005348);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.astryx-diff-viewer .astryx-token-operator {
|
|
320
|
+
color: var(--astryx-code-syntax-operator, #6a6a6a);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.astryx-diff-viewer .astryx-token-constant {
|
|
324
|
+
color: var(--astryx-code-syntax-constant, #733100);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.astryx-diff-viewer .astryx-token-punctuation {
|
|
328
|
+
color: var(--astryx-code-syntax-punctuation, #6a6a6a);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.astryx-diff-viewer .astryx-token-variable {
|
|
332
|
+
color: var(--astryx-code-syntax-variable, #111111);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
@media (prefers-reduced-motion: reduce) {
|
|
336
|
+
.astryx-diff-viewer__chevron {
|
|
337
|
+
transition: none;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|