@aiyiran/myclaw 1.0.225 → 1.0.226

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.
@@ -62,7 +62,7 @@
62
62
  btn.id = 'myclaw-artifacts-btn';
63
63
  btn.style.cssText = [
64
64
  'position: fixed',
65
- 'top: 370px',
65
+ 'top: 200px',
66
66
  'right: 0',
67
67
  'padding: 3px 10px',
68
68
  'background: rgba(100, 100, 100, 0.7)',
@@ -107,10 +107,10 @@
107
107
  panel.id = 'myclaw-artifacts-panel';
108
108
  panel.style.cssText = [
109
109
  'position: fixed',
110
- 'top: 400px',
110
+ 'top: 230px',
111
111
  'right: 0',
112
112
  'width: 380px',
113
- 'max-height: calc(100vh - 420px)',
113
+ 'max-height: calc(100vh - 250px)',
114
114
  'background: #1e1e2e',
115
115
  'border-radius: 8px 0 0 8px',
116
116
  'overflow: hidden',
@@ -258,18 +258,16 @@
258
258
  return tb.localeCompare(ta);
259
259
  });
260
260
 
261
- var topUpdatedAt = data.updated_at || '';
262
-
263
261
  sorted.forEach(function (asset, idx) {
264
- // 判断是否为最新(asset updated_at 与顶层一致)
265
- var isLatest = topUpdatedAt && asset.updated_at === topUpdatedAt;
266
- var latestSeenKey = 'myclaw-artifacts-latest-seen-' + (asset.id || asset.path);
267
- var isLatestSeen = localStorage.getItem(latestSeenKey);
268
-
269
- // 判断是否有更新(created_at !== updated_at)
270
- var isUpdated = asset.created_at && asset.updated_at && asset.created_at !== asset.updated_at;
271
- var updateSeenKey = 'myclaw-artifacts-update-seen-' + (asset.id || asset.path);
272
- var isUpdateSeen = localStorage.getItem(updateSeenKey);
262
+ // 状态判断:基于 last_open 时间戳
263
+ // - last_open [最新](从未点开过)
264
+ // - updated_at > last_open [有更新](更新了但没看过)
265
+ var assetKey = asset.id || asset.path;
266
+ var lastOpenKey = 'myclaw-artifacts-last-open-' + assetKey;
267
+ var lastOpen = localStorage.getItem(lastOpenKey); // ISO string or null
268
+ var assetUpdated = asset.updated_at || '';
269
+ var isLatest = !lastOpen;
270
+ var isUpdated = lastOpen && assetUpdated && new Date(assetUpdated) > new Date(lastOpen);
273
271
 
274
272
  var row = document.createElement('div');
275
273
  row.style.cssText = [
@@ -283,8 +281,19 @@
283
281
  row.onmouseenter = function () { row.style.background = '#2d2d3f'; };
284
282
  row.onmouseleave = function () { row.style.background = 'transparent'; };
285
283
  row.onclick = function () {
286
- if (isLatest && !isLatestSeen) localStorage.setItem(latestSeenKey, '1');
287
- if (isUpdated && !isUpdateSeen) localStorage.setItem(updateSeenKey, '1');
284
+ // 记录点开时间
285
+ localStorage.setItem(lastOpenKey, new Date().toISOString());
286
+ // 复制文件名到剪贴板
287
+ var fileName = pathParts[pathParts.length - 1] || asset.name || '未命名';
288
+ navigator.clipboard.writeText(fileName).then(function () {
289
+ var orig = nameSpan.textContent;
290
+ nameSpan.textContent = '✓ 已复制';
291
+ nameSpan.style.color = '#10b981';
292
+ setTimeout(function () {
293
+ nameSpan.textContent = orig;
294
+ nameSpan.style.color = '';
295
+ }, 800);
296
+ });
288
297
  openPreviewModal(data, asset);
289
298
  };
290
299
 
@@ -308,13 +317,12 @@
308
317
  var nameSpan = document.createElement('span');
309
318
  nameSpan.textContent = pathParts[pathParts.length - 1] || asset.name || '未命名';
310
319
  nameSpan.title = asset.path || '';
311
- // [最新] 优先于 [有更新]
312
- if (isLatest && !isLatestSeen) {
320
+ if (isLatest) {
313
321
  var badge = document.createElement('span');
314
322
  badge.style.cssText = 'color:#ff4444;font-size:10px;font-weight:bold;flex-shrink:0;';
315
323
  badge.textContent = '[最新]';
316
324
  fname.appendChild(badge);
317
- } else if (isUpdated && !isUpdateSeen) {
325
+ } else if (isUpdated) {
318
326
  var badge = document.createElement('span');
319
327
  badge.style.cssText = 'color:#10b981;font-size:10px;font-weight:bold;flex-shrink:0;';
320
328
  badge.textContent = '[有更新]';
@@ -406,7 +414,7 @@
406
414
 
407
415
  // iframe
408
416
  var iframe = document.createElement('iframe');
409
- iframe.src = buildPreviewUrl(data, asset.path);
417
+ iframe.src = buildPreviewUrl(data, asset.path) + '?t=' + Date.now();
410
418
  iframe.style.cssText = [
411
419
  'flex: 1',
412
420
  'width: 100%',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.0.225",
3
+ "version": "1.0.226",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {