@whzxc/agent-design-gallery 0.15.0 → 0.16.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 (76) hide show
  1. package/README.md +5 -2
  2. package/package.json +2 -1
  3. package/public/app.js +602 -64
  4. package/public/assets.js +25 -10
  5. package/public/boards.js +8 -3
  6. package/public/frame-identity.js +25 -12
  7. package/public/icons.js +7 -0
  8. package/public/index.html +14 -2
  9. package/public/motion-flow.js +28 -0
  10. package/public/motion-identity.js +100 -0
  11. package/public/motion-paint.js +332 -0
  12. package/public/motion-scene.js +165 -0
  13. package/public/motion-specimens.js +335 -0
  14. package/public/player.css +270 -0
  15. package/public/player.js +753 -0
  16. package/public/recent-updates.js +535 -0
  17. package/public/style.css +17 -2
  18. package/public/tokens.css +6 -0
  19. package/public/view-boards.css +131 -0
  20. package/public/view-boards.js +350 -0
  21. package/public/view-route.js +1 -1
  22. package/src/boards/motion-board.mjs +202 -0
  23. package/src/boards/token-board.mjs +9 -5
  24. package/src/cli-output.mjs +3 -1
  25. package/src/cli.mjs +52 -18
  26. package/src/http.mjs +5 -2
  27. package/src/recent-frames.mjs +295 -0
  28. package/src/recent-history.mjs +100 -0
  29. package/src/recent-job.mjs +63 -0
  30. package/src/recent-worker.mjs +171 -0
  31. package/src/server.mjs +229 -18
  32. package/src/toolkit/arch-git.mjs +8 -14
  33. package/src/toolkit/browser.mjs +1 -13
  34. package/src/toolkit/build-store.mjs +9 -1
  35. package/src/toolkit/build-worker.mjs +6 -0
  36. package/src/toolkit/build.mjs +22 -16
  37. package/src/toolkit/commands.mjs +93 -2
  38. package/src/toolkit/compare.mjs +13 -11
  39. package/src/toolkit/config.mjs +2 -2
  40. package/src/toolkit/diff-inputs.mjs +35 -26
  41. package/src/toolkit/diff.mjs +24 -11
  42. package/src/toolkit/frame-declarations.mjs +36 -0
  43. package/src/toolkit/git-blobs.mjs +50 -0
  44. package/src/toolkit/impact-inputs.mjs +11 -19
  45. package/src/toolkit/impact-selection.mjs +2 -2
  46. package/src/toolkit/impact.mjs +17 -3
  47. package/src/toolkit/implementation-map.mjs +17 -6
  48. package/src/toolkit/input-generation.mjs +15 -0
  49. package/src/toolkit/inspect-output.mjs +1 -1
  50. package/src/toolkit/inspect.d.ts +9 -1
  51. package/src/toolkit/inspect.mjs +25 -1
  52. package/src/toolkit/motion-check.mjs +382 -0
  53. package/src/toolkit/motion-css.mjs +105 -0
  54. package/src/toolkit/motion-flows.mjs +95 -0
  55. package/src/toolkit/motion-impact.mjs +87 -0
  56. package/src/toolkit/motion-inventory.mjs +202 -0
  57. package/src/toolkit/motion-label.mjs +111 -0
  58. package/src/toolkit/motion-patterns.mjs +216 -0
  59. package/src/toolkit/motion-primitives.mjs +94 -0
  60. package/src/toolkit/motion-queries.mjs +169 -0
  61. package/src/toolkit/motion.mjs +300 -0
  62. package/src/toolkit/owner.mjs +19 -6
  63. package/src/toolkit/play-endpoint.mjs +66 -0
  64. package/src/toolkit/project-index.mjs +2 -2
  65. package/src/toolkit/recent-structure.mjs +201 -0
  66. package/src/toolkit/results.mjs +2 -2
  67. package/src/toolkit/review-document.mjs +9 -4
  68. package/src/toolkit/review-embed-document.mjs +671 -0
  69. package/src/toolkit/review-filmstrip.mjs +76 -0
  70. package/src/toolkit/review-motion-card.mjs +51 -0
  71. package/src/toolkit/review-motion.mjs +159 -0
  72. package/src/toolkit/review-playback.js +123 -0
  73. package/src/toolkit/review-sheet.mjs +36 -28
  74. package/src/toolkit/review.mjs +131 -31
  75. package/src/toolkit/runtime.mjs +7 -1
  76. package/src/viewer-cache.mjs +48 -12
@@ -1,3 +1,4 @@
1
+ import { motionCard, motionStyle } from './review-motion-card.mjs';
1
2
  import { createHash } from 'node:crypto';
2
3
 
3
4
  const escape = value => String(value ?? '').replace(/[&<>"']/g, char => ({
@@ -33,11 +34,14 @@ export function reviewDocument(report, { properties, styles, templates }) {
33
34
  { id: 'added', title: 'Added', count: counts.added, html: () => added.map(card => cardHtml(card)).join('') },
34
35
  { id: 'direct', title: 'Direct changes', count: counts.direct, html: () => direct.map(card => cardHtml(card)).join('') },
35
36
  { id: 'inherited', title: 'Inherited changes', count: counts.inherited, html: () => groups.map((group, index) => inheritedHtml(group, index, byKey)).join('') },
37
+ { id: 'motion', title: 'Transition changes', count: report.motion?.cards.length ?? 0,
38
+ html: () => report.motion.cards.map((card, i) => motionCard(card, i)).join('') },
36
39
  { id: 'removed', title: 'Removed', count: counts.removed, html: () => namesHtml(removed.map(frame => originHtml(frame.origin))) },
37
40
  { id: 'moved', title: 'Moved', count: counts.moved, html: () => namesHtml(moved.map(({ before, after }) =>
38
41
  `${originHtml(before)}<span aria-hidden="true">→</span>${originHtml(after)}`)) },
39
42
  ].filter(section => section.count > 0);
40
- const script = `(${mountPreviews.toString()})();`;
43
+ const playback = report.motion ? report.motion.script + '\nreviewPlayback.mountReport();' : '';
44
+ const script = `(${mountPreviews.toString()})();` + playback;
41
45
  const hash = createHash('sha256').update(script).digest('base64');
42
46
  const metadata = JSON.stringify(cards.map(({ before, after, difference }) => ({ before, after, difference: Boolean(difference) })));
43
47
  return `<!doctype html>
@@ -45,9 +49,9 @@ export function reviewDocument(report, { properties, styles, templates }) {
45
49
  <head>
46
50
  <meta charset="utf-8">
47
51
  <meta name="viewport" content="width=device-width, initial-scale=1">
48
- <meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'sha256-${hash}'; style-src 'unsafe-inline'; img-src data:; font-src data:; base-uri 'none'; form-action 'none'">
52
+ <meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'sha256-${hash}'; style-src 'unsafe-inline'; img-src data:; font-src data:; ${report.motion ? "frame-src 'self' about:; " : ''}base-uri 'none'; form-action 'none'">
49
53
  <title>${escape(title)} · Design review</title>
50
- <style>${cssText(properties.join('\n'))}${documentStyles}</style>
54
+ <style>${cssText(properties.join('\n'))}${documentStyles}${report.motion ? motionStyle : ''}</style>
51
55
  </head>
52
56
  <body>
53
57
  <header id="top" class="masthead">
@@ -65,7 +69,7 @@ export function reviewDocument(report, { properties, styles, templates }) {
65
69
  ${failures.length ? `<section class="failures" role="alert"><h2>Some sources could not be built</h2><ul>${failures.map(failure =>
66
70
  `<li><code>${escape(failure.source)}</code> (${escape(failure.side)}) · ${escape(failure.message)}</li>`).join('')}</ul></section>` : ''}
67
71
  ${sections.map(({ id, title, count, html }) => `<section id="${id}" data-section="${id}" aria-labelledby="heading-${id}">
68
- <header class="section-head"><h2 id="heading-${id}">${title}</h2><span>${countLabel(count)}</span></header>
72
+ <header class="section-head"><h2 id="heading-${id}">${title}</h2><span>${id === 'motion' ? count + (count === 1 ? ' edge' : ' edges') : countLabel(count)}</span></header>
69
73
  <div class="section-body">${html()}</div>
70
74
  </section>`).join('')}
71
75
  ${sections.length ? '' : '<p>No changed frames.</p>'}
@@ -90,6 +94,7 @@ export function reviewDocument(report, { properties, styles, templates }) {
90
94
  ${styles.map((style, index) => `<template id="style-${index}"><style>${cssText(style)}</style></template>`).join('\n')}
91
95
  ${templates.join('\n')}
92
96
  ${cards.filter(card => card.difference).map(card => `<template id="difference-${card.index}"><img src="${escape(card.difference)}" alt="Changed pixels in ${escape(label(card))}"></template>`).join('\n')}
97
+ ${report.motion ? '<script id="motion-data" type="application/json">' + JSON.stringify({ cards: report.motion.cards, assets: report.motion.assets, theme }).replaceAll('<', '\\u003c') + '</script>' : ''}
93
98
  <script>${script}</script>
94
99
  </body>
95
100
  </html>`;