@hpyperry/dsh-ref-lib 0.7.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 (70) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +91 -0
  3. package/cordis.patch.yml +6 -0
  4. package/lib/client/RefLibBrowser.d.ts +35 -0
  5. package/lib/client/RefLibBrowser.d.ts.map +1 -0
  6. package/lib/client/RefLibBrowser.js +119 -0
  7. package/lib/client/RefLibBrowser.js.map +1 -0
  8. package/lib/client/RefLibDock.d.ts +44 -0
  9. package/lib/client/RefLibDock.d.ts.map +1 -0
  10. package/lib/client/RefLibDock.js +218 -0
  11. package/lib/client/RefLibDock.js.map +1 -0
  12. package/lib/client/RefLibPanel.d.ts +47 -0
  13. package/lib/client/RefLibPanel.d.ts.map +1 -0
  14. package/lib/client/RefLibPanel.js +59 -0
  15. package/lib/client/RefLibPanel.js.map +1 -0
  16. package/lib/client/data.d.ts +53 -0
  17. package/lib/client/data.d.ts.map +1 -0
  18. package/lib/client/data.js +74 -0
  19. package/lib/client/data.js.map +1 -0
  20. package/lib/client/index.d.ts +32 -0
  21. package/lib/client/index.d.ts.map +1 -0
  22. package/lib/client/index.js +80 -0
  23. package/lib/client/index.js.map +1 -0
  24. package/lib/client/layout.d.ts +34 -0
  25. package/lib/client/layout.d.ts.map +1 -0
  26. package/lib/client/layout.js +65 -0
  27. package/lib/client/layout.js.map +1 -0
  28. package/lib/client/locales.d.ts +80 -0
  29. package/lib/client/locales.d.ts.map +1 -0
  30. package/lib/client/locales.js +84 -0
  31. package/lib/client/locales.js.map +1 -0
  32. package/lib/client/styles.d.ts +15 -0
  33. package/lib/client/styles.d.ts.map +1 -0
  34. package/lib/client/styles.js +513 -0
  35. package/lib/client/styles.js.map +1 -0
  36. package/lib/client.js +1377 -0
  37. package/lib/client.js.map +1 -0
  38. package/lib/commands.d.ts +38 -0
  39. package/lib/commands.d.ts.map +1 -0
  40. package/lib/commands.js +49 -0
  41. package/lib/commands.js.map +1 -0
  42. package/lib/index.d.ts +36 -0
  43. package/lib/index.d.ts.map +1 -0
  44. package/lib/index.js +94 -0
  45. package/lib/index.js.map +1 -0
  46. package/lib/logic.d.ts +32 -0
  47. package/lib/logic.d.ts.map +1 -0
  48. package/lib/logic.js +48 -0
  49. package/lib/logic.js.map +1 -0
  50. package/lib/render.d.ts +18 -0
  51. package/lib/render.d.ts.map +1 -0
  52. package/lib/render.js +40 -0
  53. package/lib/render.js.map +1 -0
  54. package/lib/routes.d.ts +39 -0
  55. package/lib/routes.d.ts.map +1 -0
  56. package/lib/routes.js +210 -0
  57. package/lib/routes.js.map +1 -0
  58. package/lib/service.d.ts +88 -0
  59. package/lib/service.d.ts.map +1 -0
  60. package/lib/service.js +212 -0
  61. package/lib/service.js.map +1 -0
  62. package/lib/spec.d.ts +33 -0
  63. package/lib/spec.d.ts.map +1 -0
  64. package/lib/spec.js +13 -0
  65. package/lib/spec.js.map +1 -0
  66. package/lib/validate.d.ts +17 -0
  67. package/lib/validate.d.ts.map +1 -0
  68. package/lib/validate.js +35 -0
  69. package/lib/validate.js.map +1 -0
  70. package/package.json +64 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/client/styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA4eH,mDAAmD;AACnD,wBAAgB,kBAAkB,IAAI,IAAI,CAQzC"}
@@ -0,0 +1,513 @@
1
+ /**
2
+ * ref-lib client 样式注入:在文档头挂一张本插件专属的 <style data-plugin> 标签。
3
+ *
4
+ * 为什么不用 CSS Modules:ref-lib 的 tsdown 配置未移植 core 的 lightningcss
5
+ * CSS-Modules 插件(避免新增 native 依赖与构建面),而内联 style 无法表达
6
+ * hover/媒体查询/动画。因此采用运行时注入单张样式表——与 loader 的清理契约
7
+ * 兼容(`data-plugin` 标签在插件卸载/HMR 时由 loader 移除,重新物化时本模块
8
+ * 重新注入,幂等)。类名统一 `reflib-` 前缀防碰撞;颜色/字号/圆角全部走
9
+ * `--dsw-*` 设计令牌,随主题(浅色/深色)自动适配——这是"字体显示不一致、
10
+ * 没有设计感"的根因修复之一(旧实现硬编码 #d33 等,不随主题变化)。
11
+ * @module @hpyperry/dsh-ref-lib/src/client/styles
12
+ */
13
+ /** 插件 id(与 package.json 的 bundle 手递一致,loader 按它清理样式)。 */
14
+ const PLUGIN_ID = '@hpyperry/dsh-ref-lib';
15
+ /** 样式标签稳定 id(幂等注入的判据)。 */
16
+ const STYLE_TAG_ID = '@hpyperry/dsh-ref-lib/styles';
17
+ const CSS = `
18
+ /* ── 输入卡正上方的入口胶囊行(dock)──
19
+ 独立一行,横跨整个 composer 列;chip 与输入卡左缘对齐——用官方设计令牌
20
+ (--dsh-composer-side-clearance / --dsh-composer-card-max-width)纯 CSS 计算,
21
+ 零 JS 测量(v7 起取消 hero 相位测量/绝对定位);hero 与 active 一致,
22
+ plan/model 等工具行座位的启停不影响本行位置。 */
23
+ .reflib-dock {
24
+ box-sizing: border-box;
25
+ display: flex;
26
+ align-items: center;
27
+ min-width: 0;
28
+ /* 镜像输入卡居中:chip 落在输入卡左缘之上(宽视口 = 居中余量,窄视口 = clearance) */
29
+ padding-left: max(
30
+ var(--dsh-composer-side-clearance, 16px),
31
+ calc((100% - var(--dsh-composer-card-max-width, 100%)) / 2)
32
+ );
33
+ }
34
+
35
+ .reflib-chip {
36
+ display: inline-flex;
37
+ align-items: center;
38
+ gap: 6px;
39
+ max-width: 100%;
40
+ height: 30px;
41
+ padding: 0 10px 0 8px;
42
+ border: 1px solid var(--dsw-alias-border-l1);
43
+ border-radius: 15px;
44
+ background: transparent;
45
+ color: var(--dsw-alias-label-secondary);
46
+ font-size: 12px;
47
+ line-height: 18px;
48
+ font-weight: 500;
49
+ cursor: pointer;
50
+ transition: background-color 120ms ease, border-color 120ms ease;
51
+ }
52
+
53
+ .reflib-chip:hover {
54
+ background: var(--dsw-alias-interactive-bg-hover);
55
+ color: var(--dsw-alias-label-primary);
56
+ }
57
+
58
+ .reflib-chip:active {
59
+ background: var(--dsw-alias-interactive-bg-active);
60
+ }
61
+
62
+ .reflib-chip[data-active='true'] {
63
+ background: var(--dsw-alias-interactive-bg-hover);
64
+ border-color: var(--dsw-alias-border-l2);
65
+ color: var(--dsw-alias-label-primary);
66
+ }
67
+
68
+ .reflib-chipIcon {
69
+ display: inline-flex;
70
+ flex: none;
71
+ color: var(--dsw-alias-label-tertiary);
72
+ }
73
+
74
+ .reflib-chipLabel {
75
+ overflow: hidden;
76
+ text-overflow: ellipsis;
77
+ white-space: nowrap;
78
+ }
79
+
80
+ .reflib-chipBadge {
81
+ display: inline-flex;
82
+ align-items: center;
83
+ justify-content: center;
84
+ min-width: 18px;
85
+ height: 18px;
86
+ padding: 0 5px;
87
+ border-radius: 9px;
88
+ background: var(--dsw-alias-state-business-tertiary);
89
+ color: var(--dsw-alias-label-primary-bluish);
90
+ font-size: 11px;
91
+ line-height: 18px;
92
+ font-weight: 500;
93
+ }
94
+
95
+ /* ── 应用内目录浏览器(browse 后端)── */
96
+ .reflib-browser {
97
+ width: min(460px, 100%);
98
+ }
99
+
100
+ .reflib-browserPath {
101
+ display: flex;
102
+ align-items: center;
103
+ gap: 6px;
104
+ min-width: 0;
105
+ height: 32px;
106
+ padding: 0 8px;
107
+ border: 1px solid var(--dsw-alias-border-l2);
108
+ border-radius: 8px;
109
+ background: var(--dsw-alias-bg-layer-1);
110
+ }
111
+
112
+ .reflib-browserCrumbs {
113
+ display: flex;
114
+ flex: 1;
115
+ align-items: center;
116
+ min-width: 0;
117
+ overflow-x: auto;
118
+ white-space: nowrap;
119
+ scrollbar-width: none;
120
+ }
121
+
122
+ .reflib-browserCrumbs::-webkit-scrollbar {
123
+ display: none;
124
+ }
125
+
126
+ .reflib-browserCrumb {
127
+ display: inline-flex;
128
+ align-items: center;
129
+ flex: none;
130
+ }
131
+
132
+ .reflib-browserCrumbChevron {
133
+ flex: none;
134
+ color: var(--dsw-alias-label-caption);
135
+ }
136
+
137
+ .reflib-browserCrumbBtn {
138
+ display: inline-flex;
139
+ align-items: center;
140
+ max-width: 160px;
141
+ padding: 2px 6px;
142
+ border: none;
143
+ border-radius: 6px;
144
+ background: transparent;
145
+ color: var(--dsw-alias-label-secondary);
146
+ font-size: 12px;
147
+ line-height: 18px;
148
+ overflow: hidden;
149
+ text-overflow: ellipsis;
150
+ cursor: pointer;
151
+ }
152
+
153
+ .reflib-browserCrumbBtn:hover:not(:disabled) {
154
+ background: var(--dsw-alias-interactive-bg-hover);
155
+ color: var(--dsw-alias-label-primary);
156
+ }
157
+
158
+ .reflib-browserCrumbBtn:disabled {
159
+ opacity: 0.5;
160
+ cursor: default;
161
+ }
162
+
163
+ .reflib-browserEdit {
164
+ display: inline-flex;
165
+ align-items: center;
166
+ justify-content: center;
167
+ flex: none;
168
+ width: 24px;
169
+ height: 24px;
170
+ padding: 0;
171
+ border: none;
172
+ border-radius: 6px;
173
+ background: transparent;
174
+ color: var(--dsw-alias-label-tertiary);
175
+ cursor: pointer;
176
+ }
177
+
178
+ .reflib-browserEdit:hover:not(:disabled) {
179
+ background: var(--dsw-alias-interactive-bg-hover);
180
+ color: var(--dsw-alias-label-primary);
181
+ }
182
+
183
+ .reflib-browserEdit:disabled {
184
+ opacity: 0.5;
185
+ cursor: default;
186
+ }
187
+
188
+ .reflib-browserInput {
189
+ flex: 1;
190
+ min-width: 0;
191
+ border: none;
192
+ outline: none;
193
+ background: transparent;
194
+ color: var(--dsw-alias-label-primary);
195
+ font-size: 12px;
196
+ line-height: 18px;
197
+ }
198
+
199
+ .reflib-browserInput::placeholder {
200
+ color: var(--dsw-alias-label-dimmed);
201
+ }
202
+
203
+ .reflib-browserList {
204
+ display: flex;
205
+ flex-direction: column;
206
+ gap: 2px;
207
+ max-height: 264px;
208
+ min-height: 60px;
209
+ overflow-y: auto;
210
+ margin: 0 -8px;
211
+ padding: 0 8px;
212
+ }
213
+
214
+ .reflib-browserRow {
215
+ display: flex;
216
+ align-items: center;
217
+ gap: 8px;
218
+ min-width: 0;
219
+ padding: 7px 8px;
220
+ border: none;
221
+ border-radius: 8px;
222
+ background: transparent;
223
+ color: var(--dsw-alias-label-primary);
224
+ font-size: 13px;
225
+ line-height: 18px;
226
+ cursor: pointer;
227
+ text-align: left;
228
+ }
229
+
230
+ .reflib-browserRow:hover:not(:disabled) {
231
+ background: var(--dsw-alias-interactive-bg-hover);
232
+ }
233
+
234
+ .reflib-browserRow:disabled {
235
+ opacity: 0.5;
236
+ cursor: default;
237
+ }
238
+
239
+ .reflib-browserRowIcon {
240
+ flex: none;
241
+ color: var(--dsw-alias-label-tertiary);
242
+ }
243
+
244
+ .reflib-browserRowName {
245
+ overflow: hidden;
246
+ text-overflow: ellipsis;
247
+ white-space: nowrap;
248
+ }
249
+
250
+ .reflib-browserFooter {
251
+ display: flex;
252
+ align-items: center;
253
+ justify-content: flex-end;
254
+ gap: 8px;
255
+ min-width: 0;
256
+ }
257
+
258
+ /* ── 管理面板 ── */
259
+ .reflib-panel {
260
+ display: flex;
261
+ flex-direction: column;
262
+ gap: 10px;
263
+ min-width: 0;
264
+ }
265
+
266
+ /* 列表:固定最大高度 + 内滚动(旧实现整个面板滚动、无设计,此处分层) */
267
+ .reflib-list {
268
+ display: flex;
269
+ flex-direction: column;
270
+ gap: 2px;
271
+ max-height: 264px;
272
+ min-height: 0;
273
+ overflow-y: auto;
274
+ margin: 0 -8px;
275
+ padding: 0 8px;
276
+ }
277
+
278
+ .reflib-row {
279
+ display: flex;
280
+ align-items: center;
281
+ gap: 8px;
282
+ min-width: 0;
283
+ padding: 7px 8px;
284
+ border-radius: 10px;
285
+ background: transparent;
286
+ transition: background-color 120ms ease;
287
+ }
288
+
289
+ .reflib-row:hover {
290
+ background: var(--dsw-alias-interactive-bg-hover);
291
+ }
292
+
293
+ .reflib-row[data-removing='true'] {
294
+ opacity: 0.55;
295
+ pointer-events: none;
296
+ }
297
+
298
+ .reflib-rowIcon {
299
+ display: inline-flex;
300
+ flex: none;
301
+ color: var(--dsw-alias-label-tertiary);
302
+ }
303
+
304
+ .reflib-rowBody {
305
+ display: flex;
306
+ flex: 1;
307
+ flex-direction: column;
308
+ gap: 1px;
309
+ min-width: 0;
310
+ }
311
+
312
+ .reflib-rowName {
313
+ overflow: hidden;
314
+ color: var(--dsw-alias-label-primary);
315
+ font-size: 13px;
316
+ line-height: 18px;
317
+ font-weight: 500;
318
+ text-overflow: ellipsis;
319
+ white-space: nowrap;
320
+ }
321
+
322
+ .reflib-rowPath {
323
+ overflow: hidden;
324
+ color: var(--dsw-alias-label-tertiary);
325
+ font-family: var(--ds-font-family-code);
326
+ font-size: 11px;
327
+ line-height: 16px;
328
+ text-overflow: ellipsis;
329
+ white-space: nowrap;
330
+ }
331
+
332
+ .reflib-rowRemove {
333
+ display: inline-flex;
334
+ align-items: center;
335
+ justify-content: center;
336
+ flex: none;
337
+ width: 28px;
338
+ height: 28px;
339
+ padding: 0;
340
+ border: none;
341
+ border-radius: 8px;
342
+ background: transparent;
343
+ color: var(--dsw-alias-label-tertiary);
344
+ cursor: pointer;
345
+ transition: background-color 120ms ease, color 120ms ease;
346
+ }
347
+
348
+ .reflib-rowRemove:hover:not(:disabled) {
349
+ background: var(--dsw-alias-interactive-bg-hover-danger);
350
+ color: var(--dsw-alias-state-error-primary);
351
+ }
352
+
353
+ .reflib-rowRemove:disabled {
354
+ opacity: 0.4;
355
+ cursor: default;
356
+ }
357
+
358
+ /* 空态 / 加载态 / 错误态 */
359
+ .reflib-status {
360
+ display: flex;
361
+ flex-direction: column;
362
+ align-items: center;
363
+ gap: 6px;
364
+ padding: 22px 8px;
365
+ color: var(--dsw-alias-label-caption);
366
+ text-align: center;
367
+ }
368
+
369
+ .reflib-statusIcon {
370
+ display: inline-flex;
371
+ color: var(--dsw-alias-label-tertiary);
372
+ }
373
+
374
+ .reflib-statusText {
375
+ font-size: 13px;
376
+ line-height: 18px;
377
+ font-weight: 500;
378
+ color: var(--dsw-alias-label-secondary);
379
+ }
380
+
381
+ .reflib-statusHint {
382
+ max-width: 260px;
383
+ font-size: 12px;
384
+ line-height: 18px;
385
+ color: var(--dsw-alias-label-caption);
386
+ }
387
+
388
+ .reflib-error {
389
+ display: flex;
390
+ align-items: flex-start;
391
+ gap: 6px;
392
+ padding: 6px 10px;
393
+ border-radius: 8px;
394
+ background: var(--dsw-alias-interactive-bg-hover-danger);
395
+ color: var(--dsw-alias-state-error-primary);
396
+ font-size: 12px;
397
+ line-height: 18px;
398
+ word-break: break-word;
399
+ }
400
+
401
+ .reflib-errorIcon {
402
+ display: inline-flex;
403
+ flex: none;
404
+ margin-top: 1px;
405
+ }
406
+
407
+ .reflib-spin {
408
+ animation: reflib-spin 800ms linear infinite;
409
+ }
410
+
411
+ @keyframes reflib-spin {
412
+ to {
413
+ transform: rotate(360deg);
414
+ }
415
+ }
416
+
417
+ .reflib-divider {
418
+ height: 1px;
419
+ margin: 2px 0;
420
+ background: var(--dsw-alias-border-l2);
421
+ }
422
+
423
+ /* ── 添加表单 ──
424
+ 两组操作分离(优化点 2.1):手动输入路径 + 「添加」是一组(主路径);
425
+ 「选择目录」是另一组备选方式,独占一行,避免并排造成困惑。 */
426
+ .reflib-add {
427
+ display: flex;
428
+ flex-direction: column;
429
+ gap: 6px;
430
+ min-width: 0;
431
+ }
432
+
433
+ .reflib-addLabel {
434
+ font-size: 12px;
435
+ line-height: 16px;
436
+ font-weight: 500;
437
+ color: var(--dsw-alias-label-secondary);
438
+ }
439
+
440
+ /* 主方式:选择目录 —— 全宽主按钮(优先级最高) */
441
+ .reflib-addBrowseMain {
442
+ width: 100%;
443
+ }
444
+
445
+ /* 备选:手动输入路径组 */
446
+ .reflib-addManual {
447
+ display: flex;
448
+ flex-direction: column;
449
+ gap: 6px;
450
+ min-width: 0;
451
+ }
452
+
453
+ .reflib-addManualLabel {
454
+ font-size: 12px;
455
+ line-height: 16px;
456
+ color: var(--dsw-alias-label-caption);
457
+ }
458
+
459
+ .reflib-addRow {
460
+ display: flex;
461
+ align-items: center;
462
+ gap: 8px;
463
+ min-width: 0;
464
+ }
465
+
466
+ .reflib-addInputWrap {
467
+ flex: 1 1 180px;
468
+ min-width: 0;
469
+ }
470
+
471
+ /* 输入字体与面板一致(13px,同列表行名),placeholder 不再比整体大;
472
+ 文案已缩短保证完整显示 */
473
+ .reflib-addInputWrap > input {
474
+ width: 100%;
475
+ box-sizing: border-box;
476
+ font-size: 13px;
477
+ line-height: 18px;
478
+ }
479
+
480
+ .reflib-addHint {
481
+ font-size: 11px;
482
+ line-height: 16px;
483
+ color: var(--dsw-alias-label-caption);
484
+ }
485
+
486
+ /* 窄视口:主路径行换行,输入框占满一行 */
487
+ @media (max-width: 440px) {
488
+ .reflib-addRow {
489
+ flex-wrap: wrap;
490
+ }
491
+
492
+ .reflib-addInputWrap {
493
+ flex: 1 1 100%;
494
+ }
495
+
496
+ .reflib-addRow > button:last-child {
497
+ margin-left: auto;
498
+ }
499
+ }
500
+ `;
501
+ /** 注入/确保样式表存在(幂等;HMR 重执行时旧标签已被 loader 移除,重新注入)。 */
502
+ export function ensureRefLibStyles() {
503
+ if (typeof document === 'undefined')
504
+ return;
505
+ if (document.querySelector('style[data-plugin-css="' + STYLE_TAG_ID + '"]') !== null)
506
+ return;
507
+ const tag = document.createElement('style');
508
+ tag.dataset.plugin = PLUGIN_ID;
509
+ tag.dataset.pluginCss = STYLE_TAG_ID;
510
+ tag.textContent = CSS;
511
+ document.head.appendChild(tag);
512
+ }
513
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/client/styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,yDAAyD;AACzD,MAAM,SAAS,GAAG,uBAAuB,CAAA;AACzC,0BAA0B;AAC1B,MAAM,YAAY,GAAG,8BAA8B,CAAA;AAEnD,MAAM,GAAG,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmeX,CAAA;AAED,mDAAmD;AACnD,MAAM,UAAU,kBAAkB;IAChC,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAM;IAC3C,IAAI,QAAQ,CAAC,aAAa,CAAC,yBAAyB,GAAG,YAAY,GAAG,IAAI,CAAC,KAAK,IAAI;QAAE,OAAM;IAC5F,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;IAC3C,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAA;IAC9B,GAAG,CAAC,OAAO,CAAC,SAAS,GAAG,YAAY,CAAA;IACpC,GAAG,CAAC,WAAW,GAAG,GAAG,CAAA;IACrB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;AAChC,CAAC"}